蓝绝

博客园 首页 新随笔 联系 订阅 管理
上一页 1 2 3 4 5 6 7 8 9 10 ··· 24 下一页

2022年11月20日 #

摘要: #通过字典进行分组统计 #通过字典进行分组统计 import pandas as pd pd.set_option ( 'display.unicode.east_asian_width', True) pd.set_option ('display.max_columns',500) pd.set 阅读全文
posted @ 2022-11-20 17:19 蓝绝 阅读(21) 评论(0) 推荐(0) 编辑

摘要: #自定义函数实现分组统计 #能过自定义的函数实现分组统计 import pandas as pd df=pd.read_excel('电脑配件销售记录.xlsx') #print (df. head ())) #回顾知识点 # print (type (df['产品名称'])) #Series pr 阅读全文
posted @ 2022-11-20 16:26 蓝绝 阅读(28) 评论(0) 推荐(0) 编辑

摘要: ##分组对列采用聚合函数 #分组对列采用聚合函数 import pandas as pd pd.set_option ('display.unicode.east_asian_width',True) df=pd.read_excel('电脑配件销售记录.xlsx') #print(df.head( 阅读全文
posted @ 2022-11-20 15:47 蓝绝 阅读(135) 评论(0) 推荐(0) 编辑

摘要: ##分组数据选代 (遍历分组) for name, group in df1.groupby('产品名称'): #分组数据选代 #分组并按指定列进行计算 import pandas as pd pd.set_option ('display.unicode.east_asian_width',Tru 阅读全文
posted @ 2022-11-20 15:15 蓝绝 阅读(55) 评论(0) 推荐(0) 编辑

摘要: ##按照一列分组统计 #按照一列分组统计 import pandas as pd pd.set_option ('display.unicode.east_asian_width',True) df=pd.read_excel('电脑配件销售记录.xlsx') print (df) print (' 阅读全文
posted @ 2022-11-20 14:28 蓝绝 阅读(134) 评论(0) 推荐(0) 编辑

摘要: #apply(), map(), applymap()区别 apply()可用于Series和DataFrame,DataFrame只能运用到一行或一列,如合计的新增列 map()只适用于Series applymap()将函数应用到DataFrame中的每一个元素中 # apply(), map( 阅读全文
posted @ 2022-11-20 12:26 蓝绝 阅读(64) 评论(0) 推荐(0) 编辑

摘要: ##设置千位分隔符 apply() #设置千位分隔符 apply() import pandas as pd pd.set_option ('display.unicode.east_asian_width',True) df=pd.read_excel ('msb课程记录.xls') print 阅读全文
posted @ 2022-11-20 11:28 蓝绝 阅读(117) 评论(0) 推荐(0) 编辑

摘要: # apply()设置百分比 map ()设置百分比 #设置百分比 import pandas as pd df=pd.read_excel ('格式化数据.xls') print (df) print('1. apply()设置百分比 ') df['百分比']=df ['A1']. apply ( 阅读全文
posted @ 2022-11-20 11:11 蓝绝 阅读(110) 评论(0) 推荐(0) 编辑

摘要: #设置小数位数 import pandas as pd pd.set_option ('display.unicode.east_asian_width', True) df=pd.read_excel('格式化数据.xls') print (df) print (df.round(2)) #对df 阅读全文
posted @ 2022-11-20 10:50 蓝绝 阅读(60) 评论(0) 推荐(0) 编辑

2022年11月19日 #

摘要: #求标准差 #求标准差 import pandas as pd pd.set_option ('display.unicode.east_asian_width', True) data=[[100,90,100],[100,76,76],[76,90,76]] columns=['数学','语文' 阅读全文
posted @ 2022-11-19 22:57 蓝绝 阅读(155) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 24 下一页