Python Forum
Pivoting the data does not return what I am expecting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pivoting the data does not return what I am expecting
#1
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
Reply


Messages In This Thread
Pivoting the data does not return what I am expecting - by loulou1997 - Mar-19-2024, 04:52 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020