参考:https://blog.csdn.net/weixin_39640883/article/details/110575558
https://blog.csdn.net/qq_18351157/article/details/113740742
import pandas as pd
df = pd.read_excel(‘test.xlsx’)
对xxx列进行分组:
groups = df.groupby(‘xxx’)
对xxx、yyy列分组:
group=df.groupby([‘xxx’,‘yyy’])
使⽤get_group()⽅法获取某⼀组的数据:
res = groups.get_group(‘F’)
print(res)
返回分组后数据对应的数量:
groups.size()