Reputation: 69
I'm trying to get the row with highest frequency. I counted the frequency of which department each user go to, but now I need to associate each user to a department they frequent which would be the two index columns department and department_id.
-Edit Please forgive my stupidity. This drop box is a link to the csv file. https://www.dropbox.com/s/ttnmraxptpcw61c/user_department_freq.csv?dl=0
Upvotes: 0
Views: 239
Reputation: 323266
You can do sort_values
, the groupby
with tail
s=df.sort_values('order_id').groupby(level=0).tail(1)
Upvotes: 1