I searched for my problem and it was similar to this question. However, it did not give the expected results, so I am still stuck. I have a list like this:
import pandas as pd
l=[[1,'John','Wed',28],[1,'John','Fri',30],[2,'Alex','Fri',40],[2,'Alex','Fri',60]]
I did
o=pd.DataFrame(l,columns=['id','name','day','marks'])
r = o.groupby(['id','name','day']).marks.mean().reset_index().values.tolist()
now what i got looks like this
[[1,'John','Wed',28],[1,'John','Fri',30],[2,'Alex','Fri',50]]
can somebody please help me to get something like
[[1,'John',[['Wed',28],['Fri',30]]], [2,'Alex',[['Fri',50]]]]