Change from df.columns.labels to df.columns.codes
Created originally on Bitbucket by Meongsu Lee
I use python 3.7 with pandas v1.0.0. Recently pandas MultiIndex attribute ‘labels’ change its name to ‘codes’. The lines 34-35 in ‘dataframe.py’, therefore are needed to change as following ways
if header:
if df.columns.nlevels > 1:
rows = expand_levels(df.columns.levels, df.columns.codes)
else:
rows = [list(df.columns.values)]
from
if header:
if df.columns.nlevels > 1:
rows = expand_levels(df.columns.levels, df.columns.labels)
else:
rows = [list(df.columns.values)]
p.s. I am so sorry if I am not following the rule to write. This is the first time to create an issue. If there are problems with my writing, I am glad to rewrite the post.