Pandas: Change a specific column name in dataframe having multilevel columns

后端 未结 3 1490
别那么骄傲
别那么骄傲 2021-02-14 02:05

I want to find the way change name of specific column in a multilevel dataframe.

With this data:

data = {
    (\'A\', \'1\', \'I\'): [1, 2, 3, 4, 5], 
           


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-14 02:20

    You can simply change it like DF.columns.levels=[[u'Z', u'B', u'C', u'D', u'E'],[u'5', u'2', u'3', u'4', u'5'],[u'IIIIII', u'II', u'III']]

提交回复
热议问题