pandas.DataFrame.rank
The rank method of a pandas DataFrame returns another pandas DataFrame in which the values are the result of assigning ranges (from 1 to n) to the values of the original DataFrame, considering them ordered, by default, from lowest to highest along axis 0. That is, the smallest value in a column receives rank 1, the next rank 2, and so on. The method parameter controls the method of assigning ranges to matching values.
The index of the original DataFrame is preserved. The assigned ranges are real numbers.