我把功能转成代码
1、读取excel
import pandas as pd
excelpath = 'D:\\data.xls'
df = pd.read_excel(excelpath, encoding='utf-8')
2、希望能用python对数据表进行整理,保留a1、a2、a3、asset_name、date、count、user,
new_df = df[[a1、a2、a3、asset_name、date、count、user]]
3、并且将同类型的行对count和user求和,
假设a1列是你说的同类型。
groups = df.groupby(['a1']).sum()
4、每一天都有一个表,通过循环把每个表的数据都整理汇总导出新的excel表格。
excelpath = 'D:\\result.xls'
groups.to_excel(excelpath, index=True)