I have a simple dataframe:
import pandas as pd
df=pd.DataFrame({"Mode":["Air", "Rail", "Car"], "Grp1":[0.7, 0.2, 0.1], "Grp2":[0.9, 0.05, 0.05]})
df
Mode Grp1 Grp2
0 Air 0.7 0.90
1 Rail 0.2 0.05
2 Car 0.1 0.05
What I would like to do is to take the existing "Mode" column in my dataframe and put it as level=1 in the multi-level column structure, so that I would get something like:
Grp1 Grp2
Air Rail Car Air Rail Car
0.7 0.2 0.1 0.90 0.05 0.05
Could someone help me with this one please?