I have Pandas DataFrame that looks like:
id a b c col
1 a 1 2 Null 'aa'
2 a 2 2 3 'aa'
3 b 4 3 1 'bb'
4 c 1 Null 3 'gg'
5 c Null 2 Null 'gg'
I want to groupby the columns to get the following:
id new_col col
1 a [1, 2, 2, 2, 3] 'aa'
2 b [4, 3, 1] 'bb'
3 c [1, 3, 2] 'gg'
Is it possible to do it using pd.groupby?
Thanks