Reputation: 71
I have a sorted Series, is there a simple way to change it from
A 0.064467 B 0.042283 C 0.037581 D 0.017410 dtype: float64
to
A 1 B 2 C 3 D 4
Upvotes: 2
Views: 32
Reputation: 323266
You can just do rank
rank
df.rank(ascending=False)
Upvotes: 1