I am trying to reshape a given DataFrame
ts type value1 value2
0 1 foo 10 16
1 1 bar 11 17
2 2 foo 12 18
3 2 bar 13 19
4 3 foo 14 20
5 3 bar 15 21
into the following shape:
foo bar
value1 value2 value1 value2
1 10 16 11 17
2 12 18 13 19
3 14 20 15 21
I know how to do this programatically, this is not the point. But I for the life of me can't find the proper pandas method to do this efficiently.
Help would be greatly appreciated.