So is there a way to groupBy a DataFrame object and then for the remaining columns, put all the entries into a set (or list with filtered unique values). So something like this
Name Date Amount purchase
0 Jack 2016-01-31 10 'apple'
1 Jack 2016-02-29 5 25
2 Jack 2016-02-29 8 'B+'
3 Jill 2016-01-31 10 'D2'
4 Jill 2016-02-29 5 E
4 Jill 2016-02-29 5 E
and output after grouping by the first two columns.
Name Date Amount purchase
0 Jack 2016-01-31 [10] [apple]
1 Jack 2016-02-29 [5,8] [25,'B+']
3 Jill 2016-01-31 [10] ['D2']
4 Jill 2016-02-29 [5] ['E']
So I can do it for each column with df_data = df.groupby(['Name', 'Date'])['Amount'].apply(set)
and then concatenate them, however if the list was long, is there a shorter more elegant solution?