For example, in the dataframe below, I want to remove the top index (sum/lambda) so it prints in a cleaner fashion. I'm going to be then exporting that dataframe to excel.
Asked
Active
Viewed 32 times
0
-
1`df.droplevel(axis=1)` ? – anky Jun 16 '20 at 16:48
-
1`df.columns = df.columns.droplevel()` – DavideBrex Jun 16 '20 at 16:49
-
2@anky Possible duplicate? [Pandas: drop a level from a multi-level column index?](https://stackoverflow.com/q/22233488/13328010) – DavideBrex Jun 16 '20 at 16:50
-
1@DavideBrex thank you for the link – anky Jun 16 '20 at 16:53
-
Yeah, I don't know why I thought droplevel might change the format. That's work though, thank you. – Robert Criqui Jun 16 '20 at 17:29