I simply want the reverse operation of this command:
.reset_index(level=['ID'], inplace=True, col_level=1)
Now I have a dataframe:
DONNES_PRODUITS ... PYC_INTEGRES
ID UE PERIMETRE ... TVSU8 TV001 TV002
NUMBER ...
74 2 U4A MAIZON ... NaN NaN NaN
74 3 U4A MAIZON ... NaN NaN NaN
74 6 U4A MAIZON ... NaN NaN NaN
I want set ID as an index with NUMBER, for created a multi_index.
expected output:
DONNES_PRODUITS ... PYC_INTEGRES
UE PERIMETRE ... TVSU8 TV001 TV002
NUMBER ID ...
74 2 U4A MAIZON ... NaN NaN NaN
74 3 U4A MAIZON ... NaN NaN NaN
74 6 U4A MAIZON ...
I tried this solution:
result.set_index(['ID'], append=True)
I got the error message None of ['ID'] are in the columns