Reputation: 267
I have the following Series:
ser = pd.Series({'a': 10, 'b': 21, 'c': 12, 'd': 5, 'e': 26, 'd': 17})
Which method can I use to identify the order of an element relative to others? For example, if I sort the Series in ascending order c
is in the second position.
Upvotes: 1
Views: 48
Reputation:
You can use the rank method:
ser.rank()
Out[178]:
a 1.0
b 4.0
c 2.0
d 3.0
e 5.0
dtype: float64
Upvotes: 3