I want a function that would give me the index of an element in a pandas Series object if the Series was sorted. I made the following implementation:
def series_ordering(series):
positions = series.reset_index(drop=True, inplace=False).sort_values().index
return pd.Series(positions, index=series.index)
but it feels kind of basic. Something like this is necessary for computing quantiles for example. So I would expect an easier way to achieve this to be part of the library. Is something like this easily available in Pandas?