0

Hi I have pandas group by object with output as below.

                  items
month_name year        
Apr        2001   98714
Dec        2000  146381
Feb        2001   82279
Jan        2001   77016
Mar        2001  102462
May        2001   53898

I would like to however transform it as a basic data frame as below (with all indexes and columns of group by object becoming columns of the new data frame).

month_name year  Items      
Apr        2001   98714
Dec        2000  146381
Feb        2001   82279
Jan        2001   77016
Mar        2001  102462
May        2001   53898

I would need to do pivot on this new dataframe for further processing. I know it is straightforward and for some reason not getting it. Thanks much

cs95
  • 379,657
  • 97
  • 704
  • 746

0 Answers0