pandas group by list contents code example
Example 1: group by pandas to list
df.groupby('a')['b'].apply(list)
Example 2: group by list python
values = set(map(lambda x:x[1], mylist))
newlist = [[y[0] for y in mylist if y[1]==x] for x in values]