python的groupby方法

group by ()方法以后
df_power.groupby(by=['id']) --

报错:
Can only merge Series or DataFrame objects, a was passed

修改成

df_day_original = df_power.groupby(by=['id']).agg('id').reset_index()

报错:

Can only merge Series or DataFrame objects, a was passed

解决办法:分开写

df_power.groupby(by=['id'])
df_day_original = df_power.reset_index()

你可能感兴趣的:(python,pandas,开发语言)