I have a dataframe as below.
a x 10
b x 11
c x 15
a y 16
b y 17
c y 19
a z 20
b z 21
c z 23
and I want to transform it as below:
x y z
a 10 16 20
b 11 17 21
c 15 19 23
Currently I am making the original DF into multiple Data Frames (each for "a", "b" and "c") and then transposing and merging back.
I am sure there would be an optimum solution. Hence looking for help.