Advertisement
elena1234

ranking dataframe with rank in Python

Mar 5th, 2023 (edited)
904
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. titanic['fare_rank'] = titanic.fare.rank(ascending = False, method = min) # create rank by fare column
  2. titanic.sort_values('fare_rank', ascending = True)
  3.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement