I have a pandas data frame df like:
df
a b A 1 A 2 B 5 B 5 B 4 C 6
I want to group by the first column and get second col
A handy way to achieve this would be:
df.groupby('a').agg({'b':lambda x: list(x)})
Look into writing Custom Aggregations: https://www.kaggle.com/akshaysehgal/how-to-group-by-aggregate-using-py