I have a dataframe in the format below:
DF1: Shape of Original dataframe is (1200, 9)
This is Sample dataframe
x1 x2 x3 Group
1.0 0.0 0.0 A
0.0 0.0 0.0 A
0.0 3.0 11.0 A
0.0 0.0 0.0 A
0.0 1.0 0.0 A
0.0 0.0 0.0 E
0.0 0.0 0.0 E
0.0 0.0 0.0 E
0.0 0.0 6.0 E
0.0 0.0 0.0 E
I want the output in the following format:
DF_Res:
Group A E
x1 1.0 0.0
x2 0.0 0.0
x3 0.0 0.0
x1 0.0 0.0
x2 0.0 0.0
x3 0.0 0.0
x1 0.0 0.0
x2 3.0 0.0
x3 11.0 0.0
x1 0.0 0.0
x2 0.0 0.0
x3 0.0 6.0
x1 0.0 0.0
x2 1.0 0.0
x3 0.0 0.0
I want to transform my columns so that they become group and Group become column header.
Please help.
Thanks
0?Group == 'A'? Not very clear from your post. They need to aggregated in some way, but sounds like you don't want to aggregate them?