I have a pandas dataframe with multiple rows that can share an ID. Each row also has a value for the "label" column. What I would like is to combine all the labels that share the same ID.
For example, say this is what I have:
id | label
-----------
1 a
1 b
2 a
2 c
2 d
3 e
What I would like is something like this:
id | label_list
----------------
1 [a,b]
2 [a,c,d]
3 [e]
So the labels that shared the same ID were combined and made into a list. What would be the most efficient way to do this?