# 拆分为工作表 import pandas as pd import xlrd data = pd.read_excel(r"../数据/2252BG.xlsx", sheet_name="2252BG") area_list = list(set(data['时间'])) writer = pd.ExcelWriter(r"../拆好的表/2252.xlsx") data.to_excel(writer, sheet_name="总表", index=False) for j in area_list: df = data[data['时间'] == j] df.to_excel(writer, sheet_name=j, index=False) writer.save()
# 拆分为工作表 import pandas as pd import xlrd # 打印某一列中的信息,数据去重 filepath = r'../数据/2252.xlsx' data = pd.read_excel(filepath, sheet_name="2252BG") class_list = list(data['时间'].unique()) print(class_list) # 将表拆分为单独的新表 # for i in class_list: # data_cut = data[data["时间"]==i] # data_cut.to_excel(r'.%s.xlsx'%(i),encoding = 'utf-8')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)