I have a dataframe (df) with 5 columns. I want to use 'group by' for the first 3 columns, and put in columns 4 the values accociated in a list and idem for columns 5. My code works for columns 4 :
df_new=df.groupby(['1','2', '3'])['4'].apply(list)
But I do not know how to manage for the columns 5.
df_new=df.groupby(['1','2', '3'])['4', '5'].apply(list)
doesn't work.