I am having some difficulty in organizing my dataframe. I think it's pretty simple, but I have been stuck with this for too long:
This is df1:
Output Energy, (Wh/h) Lights (Wh) Lights+Media (Wh) Total Usage (h) \
Hour
1 0.0 0.0 0.0 0.0
2 0.0 0.0 0.0 0.0
3 0.0 0.0 0.0 0.0
4 0.0 0.0 0.0 0.0
5 0.0 0.0 0.0 0.0
I'd prefer this to be transposed for ease of use:
df2 =df1.T
gives me:
Hour 1 2 3 4
Output Energy, (Wh/h) 0.0 0.0 0.0 0.0
Lights (Wh) 0.0 0.0 0.0 0.0
Lights+Media (Wh) 0.0 0.0 0.0 0.0
Total Usage (h) 0.0 0.0 0.0 0.0
Lights (h) 0.0 0.0 0.0 0.0
Light+Media (h) 0.0 0.0 0.0 0.0
But ultimately, I would like it to look like this:
Hour
1 2 3 4
Output Energy, (Wh/h) 0.0 0.0 0.0 0.0
Lights (Wh) 0.0 0.0 0.0 0.0
CU-101 Lights+Media (Wh) 0.0 0.0 0.0 0.0
Total Usage (h) 0.0 0.0 0.0 0.0
Lights (h) 0.0 0.0 0.0 0.0
Light+Media (h) 0.0 0.0 0.0 0.0
I have been trying to add the 'Cu-101' as a multilevel column, but to no avail. Should I add this before or after it is transposed?
Also, moving the 'Hour' - I set this column as the index, but how do I move it to a new level?
MultiIndex? Or something missing? Can you explain more if answer is not what you want?