Mar-19-2024, 04:52 PM
Hi, I have a coding assignment where I am required to pivot the following data:
face_id Manipulation condition score
101 Averageness manipulated 4.428571
101 Averageness none 3.400000
101 Femininity manipulated 4.235294
101 Femininity none 3.625000
101 Masculinity manipulated 3.666667
I have tried to pivot the data to have the following columns instead: face_id, Manipulation, manipulated, none (so it looks like below):
face_id, Manipulation, manipulated, none
2, Averageness, 4.416666666666667, 4.117647058823529
2, Femininity, 3.7777777777777777, 4.130434782608695
2, Masculinity, 4.0, 4.466666666666667
2, Symmetry, 4.3076923076923075, 4.25
3, Averageness, 3.25, 2.310344827586207
However, my data ends up looking like this (or along similar lines):
condition face_id manipulated none
0 101 4.094538 3.708631
1 102 3.139303 2.855159
2 106 4.027617 3.859127
3 107 3.268579 3.208618
4 109 2.739729 2.476786
I am unsure how to get the data to pivot the way I need it to, and any guidance would be greatly appreciated! If any more information is needed, I'm happy to provide it
face_id Manipulation condition score
101 Averageness manipulated 4.428571
101 Averageness none 3.400000
101 Femininity manipulated 4.235294
101 Femininity none 3.625000
101 Masculinity manipulated 3.666667
I have tried to pivot the data to have the following columns instead: face_id, Manipulation, manipulated, none (so it looks like below):
face_id, Manipulation, manipulated, none
2, Averageness, 4.416666666666667, 4.117647058823529
2, Femininity, 3.7777777777777777, 4.130434782608695
2, Masculinity, 4.0, 4.466666666666667
2, Symmetry, 4.3076923076923075, 4.25
3, Averageness, 3.25, 2.310344827586207
However, my data ends up looking like this (or along similar lines):
condition face_id manipulated none
0 101 4.094538 3.708631
1 102 3.139303 2.855159
2 106 4.027617 3.859127
3 107 3.268579 3.208618
4 109 2.739729 2.476786
I am unsure how to get the data to pivot the way I need it to, and any guidance would be greatly appreciated! If any more information is needed, I'm happy to provide it