I need help rearranging a data frame using pandas. Currently it is disorganized and I would like to organize it better. This is my current DataFrame:
username question answer pre post
0 a Q1 abc 2.2 3.3
1 a Q2 bcd 2.2 3.3
2 a Q3 deg 2.2 3.3
3 b Q1 cde 3.1 3.5
4 b Q2 cee 3.1 3.5
There are 5000+ rows, 21 unique questions, 350 unique usernames. All answers are different, but the pre and post floats are the same for the same user (regardless of question/answer).
I would like help to change the data frame to this:
username Q1 Q2 Q3 (continued to Q21) pre post
0 a abc bcd deg ...... 2.2 3.3
1 b cde cee ... ...... 3.1 3.5
2 c ....
3 d ....