I have a data like this
A 12
B 15
C 9
C 12
B 15
A 24
B 9
C 3
A 9
I would like to get the output using python code as shown below
A B C
12 15 9
24 15 12
9 9 3
Please help to get the python code.
I have a data like this
A 12
B 15
C 9
C 12
B 15
A 24
B 9
C 3
A 9
I would like to get the output using python code as shown below
A B C
12 15 9
24 15 12
9 9 3
Please help to get the python code.
pd.DataFrame(df.groupby(0).agg(list).to_dict()[1])
output:
A B C
0 12 15 9
1 24 15 12
2 9 9 3