I have Pandas dataframe with two columns. One is unique identifier and second is the name of product attached to this unique identifier. I have duplicate values for identifier and product names. I want to convert one column of product names into several columns without duplicating identifier. Maybe I need to aggregate product names through identifier.
My dataframe looks like:
ID Product_Name
100 Apple
100 Banana
200 Cherries
200 Apricots
200 Apple
300 Avocados
I want to have dataframe like this:
ID
100 Apple Banana
200 Cherries Apricots Apple
300 Avocados
Each product along each identifier has to be in separate column
I tried pd.melt, pd.pivot, pd.pivot_table but only errors and this errors says No numeric types to aggregate
Any idea how to do this?