蓝绝

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

2022年11月27日 #

摘要: #按时期统计并显示数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('msb课程销售记录.xlsx') #df.head() df=df[['订单 阅读全文
posted @ 2022-11-27 10:31 蓝绝 阅读(72) 评论(0) 推荐(0) 编辑

摘要: #按不同时期统计数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('日期.xlsx') df=df.set_index('订单付款日期.xlsx' 阅读全文
posted @ 2022-11-27 10:07 蓝绝 阅读(15) 评论(0) 推荐(0) 编辑

摘要: #获取指定区域的数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('msb课程销售记录.xlsx') #df.head() df=df[['订单付 阅读全文
posted @ 2022-11-27 09:48 蓝绝 阅读(38) 评论(0) 推荐(0) 编辑

摘要: # #dt对象的使用 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('日期.xlsx') df['日期']=pd. to_datetime (df[ 阅读全文
posted @ 2022-11-27 09:45 蓝绝 阅读(47) 评论(0) 推荐(0) 编辑

2022年11月21日 #

摘要: ##将各种日期字符串转成日期格式 #将各种日期字符串转成日期格式 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.DataFrame({'原日期':['14-Feb-20' 阅读全文
posted @ 2022-11-21 23:06 蓝绝 阅读(138) 评论(0) 推荐(0) 编辑

摘要: # #导出到csv文件 import pandas as pd df=pd.DataFrame( {'编号':['1001','1002','1003'], '姓名':['张三','李四','王五'], '总成绩':[740,658,543] }) df #导出到csv文件,不显示索引,导出列为[' 阅读全文
posted @ 2022-11-21 22:10 蓝绝 阅读(28) 评论(0) 推荐(0) 编辑

2022年11月20日 #

摘要: ##数据导出,保存成Excel文件 #数据导出,保存成Excel文件 import pandas as pd df=pd.DataFrame( {'编号':['1001','1002','1003'], '姓名':['张三','李四','王五'] }) df df.to_excel('数据导出-学生 阅读全文
posted @ 2022-11-20 22:38 蓝绝 阅读(150) 评论(0) 推荐(0) 编辑

摘要: #纵向表合并--行相加 #concat方法,纵向数据合并(表结构相同,首尾相连) import pandas as pd df1=pd.read_excel('数据合并concat.xlsx', sheet_name='Sheetl') df2=pd.read_excel('数据合并concat.x 阅读全文
posted @ 2022-11-20 22:06 蓝绝 阅读(498) 评论(0) 推荐(0) 编辑

摘要: #数据合并一对一 #相同的列进行合并 import pandas as pd df1=pd.read_excel('student1.xlsx') df2=pd.read_excel('student2.xlsx') #dfl #测试数据读取 #数据合并 new_df=pd.merge(df1,df 阅读全文
posted @ 2022-11-20 21:30 蓝绝 阅读(36) 评论(0) 推荐(0) 编辑

摘要: #数据位移 #数据位移 import pandas as pd data=[7532, 3937, 9447, 8765, 4564] index=[1, 2, 3, 4, 5] df=pd. DataFrame (data=data, index=index, columns=['OPPO' ]) 阅读全文
posted @ 2022-11-20 17:37 蓝绝 阅读(31) 评论(0) 推荐(0) 编辑

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