Reputation: 369
I have following Pandas DataFrame:
and would like to convert the columns to look like this:
How can I create column hierarchy? Thank you for any pointer.
Upvotes: 1
Views: 208
Reputation: 150765
Can you try:
df.columns = pd.MultiIndex.from_tuples(df.columns)
Upvotes: 1