removing the name of a pandas dataframe index after appending a total row to a dataframe

后端 未结 2 1659
-上瘾入骨i
-上瘾入骨i 2021-01-12 00:06

I have calculated a series of totals tips by day of a week and appended it to the bottom of totalspt dataframe.

I have set the index.name f

2条回答
  •  粉色の甜心
    2021-01-12 00:38

    You can use rename_axis. Since 0.17.0

    In [3939]: df
    Out[3939]:
    XX  A  B
    0   1  2
    
    In [3940]: df.rename_axis(None, axis=1)
    Out[3940]:
       A  B
    0  1  2
    
    In [3942]: df = df.rename_axis(None, axis=1)
    
    In [3943]: df
    Out[3943]:
       A  B
    0  1  2
    

提交回复
热议问题