I have seen lots of examples on how to arrange dataframe row indexes hierarchically, but I am trying to do the same for columns and am not understanding the syntax:
I am reading the contents from a csv file as follows
df=pandas.read_csv("data.csv")
and data.csv contains something like:
rno,marktheory1,marklab1,marktheory2,marklab2
1,78,45,34,54
2,23,54,87,46
so In[1]:df gives
rno mark1 lab1 mark2 lab2
0 1 78 45 34 54
1 2 23 54 87 46
What I would like to do is add a hierarchical index or even something akin to a tag to the columns, so that they looked something like this:
Subject1 Subject2
rno mark1 lab1 mark2 lab2
0 1 78 45 34 54
1 2 23 54 87 46