I would like to rename one of my levels in a multiindexed columns dataframe in pandas.
df.columns.names
gives me
FrozenList(['level0', 'level1'])
I want to rename 'level0' to 'main'.
I have tried different approaches, none works:
df.columns.set_names('findingkey', level=0, inplace=True)
gives me TypeError: 'list' object is not callable
I also tried to do it directly:
df.columns.names[0]='main'
with output: TypeError: 'FrozenList' does not support mutable operations.