peringkat padat di panda

df['Rank'] = df.Year.rank(method='dense').astype(int)

df
Fantastic Frog