如何交换 pandas 数据透视表中的列标题? [英] How to swap the column header in pandas pivot table?
本文介绍了如何交换 pandas 数据透视表中的列标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I got a datframe after pivoting like this .
AVG GrossProfit AVG PMV Loss% Sales
ParentAuction Copart IAA Copart IAA Copart IAA Copart IAA
Make
Acura 112.99 NaN -15.53 NaN 36.46 NaN 96.0 NaN
如何将列级别更改为这种列格式?
How to change the column levels to this format of columns ?
ParentAuction Copart IAA
AVG GrossProfit AVG PMV Loss% Sales AVG GrossProfit AVG PMV Loss% Sales
Make
Acura 112.99 -15.53 36.46 96.0 NaN NaN NaN NaN