pandas.api.typing.Rolling.rank
pandas 3.1.1 · Window operations · method
Assign positions in sorted order and choose how to handle ties.
Call syntax
pd.api.typing.Rolling.rank(method='average', ascending=True, pct=False, numeric_only=False)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
method |
Optional Positional or keyword Default 'average' |
{'average', 'min', 'max'} Choose the algorithm used to calculate, align, or fill the result. |
ascending |
Optional Positional or keyword Default True |
bool Choose ascending or descending order. Some sorting methods take one flag per sort key. |
pct |
Optional Positional or keyword Default False |
bool Express ranks or results as fractions where the API supports this option. |
numeric_only |
Optional Positional or keyword Default False |
bool Restrict the calculation to columns pandas considers numeric where applicable. |
Returns
Series or DataFrame