This is my group by command:
pdf_chart_data1 = pdf_chart_data.groupby(\'sell\').value.agg([\'sum\']).rename(
columns={\'sum\':\'valuesum\',\'sell\' : \'sellt
You cannot rename it, because it is index
. You can add as_index=False
for return DataFrame
or add reset_index:
pdf_chart_data1=pdf_chart_data.groupby('sell', as_index=False)['value'].sum()
.rename(columns={'sum':'valuesum','sell' : 'selltime'})
Or:
pdf_chart_data1=pdf_chart_data.groupby('sell')['value'].sum()
.reset_index()
.rename(columns={'sum':'valuesum','sell' : 'selltime'})