I have a dataframe with two columns, with string entries, eg:
Col1 Col2
E1 K1
E2 K2
E3 K3
...
I want to create an index on Col2 but the entries there are not unique. So I would like to merge all rows of shared entries in Col2. Say K2, K3 are identical. Then after the merge what I would like to have is the Col1 values serialized into a list forming just one row, ie:
Col1 Col2
E1 K1
[E2, E3] K2
...
What would be the cleanest way of achieving this?