dataframe 分组后多列计算

g = history.groupby(by=['LinkTradeCode', 'InstrumentType', 'PutOrCall', 'KnockPrice', 'InstrumentGroup']).agg({'Volume': sum, 'CashCNY': sum})
# 取消分组后的索引
h = g.reset_index()

猜你喜欢

转载自blog.csdn.net/panpan_v1/article/details/88824308