polars.Series.argsort

Series.argsort(reverse: bool = False, nulls_last: bool = False) polars.internals.series.Series

Index location of the sorted variant of this Series.

Returns
indexes

Indexes that can be used to sort this array.

nulls_last

Place null values last.

Examples

>>> s = pl.Series("a", [5, 3, 4, 1, 2])
>>> s.argsort()
shape: (5,)
Series: 'a' [u32]
[
    3
    4
    1
    2
    0
]