I have an intresting situtation my dataframe looks something like this.
marks_in_test_1 marks_in_test_2
rank1 {'english': 25, 'maths': 30} {'english': 15, 'maths': 30, 'science': 45}
rank4 {'english': 34, 'maths': 39} {'english': 35, 'maths': 31}
I want to convert it into something as follows which looks like a pivot table in which old columns values also act as indexes.
english maths Science
rank1 marks_in_test_1 25 30 NaN
rank1 marks_in_test_2 15 30 45
rank2 marks_in_test_1 34 35 NaN
rank2 marks_in_test_2 39 31 NaN
I have tried to look into pandas pivot docs but nothing helpful was there.