put values of a agg function in list

PHOTO EMBED

Wed Feb 09 2022 01:49:45 GMT+0000 (Coordinated Universal Time)

Saved by @Milados

df_ordered_p_l = df.sort_values(['User', 'year', 'week', 'P/L', 'percentage'], 
                                    ascending=[True, True,True, False, False]).groupby(['User', 'year', 'week']).agg(P_L_ordered = ('P/L',lambda x: list(x)),
                                                                                                                     percentage_ordered = ('percentage', lambda x: list(x))
                                                                                                                     )
content_copyCOPY

http://localhost:8888/notebooks/Untitled.ipynb