My dataframe looks like this:
ID Class
0 9
1 8
1 6
2 6
2 2
3 15
3 1
3 8
What I would like to do is merging rows with same ID value in a way below:
ID Class1 Class2 Class3
0 9
1 8 6
2 6 2
3 15 1 8
So for each ID which exists more than once, I want to create new column(s) and move values from rows to those columns. What is the fastest way to do this? I tried using groupby but it didn't give me appriopate results.