Can pandas groupby aggregate into a list, rather than sum, mean, etc?

I used the following

grouped = df.groupby('A')

df = grouped.aggregate(lambda x: tuple(x))

df['grouped'] = df['B'] + df['C']

Leave a Comment