I have a data frame as below:
dummy = pd.DataFrame([[1047,2021,0.38],[1056,2021,0.19]],columns=['reco','user','score'])
dummy
reco user score
0 1047 2021 0.38
1 1056 2021 0.19
I want the output to look like this:
user score reco
2021 [0.38, 0.19] [1047, 1056]
I want to group by user, and then the lists should be created by score in descending order and the reco should be corresponding to its score values.
I tried collect_list but the order changes. I want to keep the same order.