1

I'm doing a group by in a pandas dataframe, how can I change the name of the aggregate column after the group by?

df.groupby(['open_year','open_month','source']).size().reset_index()

it creates a dataframe with the following columns

open_year, open_month, CREATED_BY_REVISED, 0

I', trying to rename the last colum(0) but it doesn't work

x.rename({'0':'xyz'})
HHH
  • 6,085
  • 20
  • 92
  • 164

0 Answers0