I have created a dataframe that looks like:
ID first_name last_name amount
12 Stef Adams 23
12 Stef Adams 14
45 Jacob Foster 73
45 Jacob Foster 71
45 Jacob Foster 91
51 Lena Bill 38
I want to collapse these rows such that I want amount to be in the same column seperated by column for a given ID, first and last name. So the dataframe should look like:
ID first_name last_name amount
12 Stef Adams 23,14
45 Jacob Foster 73,71,91
51 Lena Bill 38
How can I achieve this? Insights will be appreciated.