Example:
data={'P1_1': ['1', '6', '5','8', '4', '7', '5', '7', '1', '7', '3', '2', '1', '4', '7', '5', '7', '1'],
'P1_2':['3', '7', '7','9', '8', '10', '8', '9', '3', '10', '9', '5', '3', '8', '9', '6', '7', '5'],
'P2_1': ['1', '2', '3','4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18'],
'P2_2': ['3', '7', '7','9', '8', '10', '8', '9', '8', '10', '12', '13', '14', '8', '17', '8', '2', '5']}
df=pd.DataFrame(data)
This is the df that I have.
What I want is now to reorder the columns. P1 and P2 are the names of a Category, the second number _1 and _2 are time points. Now I want the categories shown in rows and the time points in columns by receiving the values. It should look the following way:
In the 2nd example I added a 3rd P only for having more values.
I think there might be a familiar way. Can anyone give me a direction to think?