I'm looking to combine pandas rows in a Dataframe by matching userID into a list. There are 1000+ userIDs and multiple entries for each.
I want one row for each user. I found a thread that does the complete opposite of what I am trying to do, which is: How to explode a list inside a Dataframe cell into separate rows Thanks in advance, guys.
what would need to be done for a rows with string and number?
userID alcohol
U1001 No_Alcohol_Served 7.0
Wine-Beer 2.0
U1002 Full_Bar 1.0
No_Alcohol_Served 3.0
Wine-Beer 6.0
U1003 Full_Bar 2.0
No_Alcohol_Served 8.0
Wine-Beer 3.0
U1004 No_Alcohol_Served 4.0
Wine-Beer 4.0
I would like to say something like:
U1001 : No_Alcohol_served:7.0, Wine-Beer:2.0
U1002 : Full_Bar:1.0, No_Alcohol_served:3.0, Wine_beer:6.0
so on and so forth