excel - Pandas: Remove aggfun np.sum labels and value labels from pivot table -
i have created pandas pivot table, , trying remove 'sum' , 'length' rows output xlsx.
so far have tried remove 2 rows upon exporting pivot table xlsx. have tried read in exported pivot table , dataframe.drop 2 rows , re-export.
i not having luck. in advance!
link pic: http://i.stack.imgur.com/amjfy.png
you can use droplevel
:
df.columns = df.columns.droplevel([0,1]) print df status x y z code 13.0 6 20 b nan 472 472 c nan 105 105 d 13.0 584 598
and maybe reset_index
rename_axis
(new in pandas
0.18.0
):
df = df.reset_index().rename_axis(none, axis=1) print df code x y z 0 13.0 6 20 1 b nan 472 472 2 c nan 105 105 3 d 13.0 584 598
Comments
Post a Comment