rank("dense", ascending=False) code example Example: dense rank in pandas df['Rank'] = df.Year.rank(method='dense').astype(int) df