polars.Expr.argsort#
- Expr.argsort(descending: bool = False, nulls_last: bool = False) Self [source]#
Get the index values that would sort this column.
Alias for
Expr.arg_sort()
.Deprecated since version 0.16.5: Expr.argsort will be removed in favour of Expr.arg_sort.
- Parameters:
- descending
Sort in descending order.
- nulls_last
Place null values last instead of first.
- Returns:
- Expr
Series of dtype UInt32.
Examples
>>> df = pl.DataFrame( ... { ... "a": [20, 10, 30], ... } ... ) >>> df.select(pl.col("a").argsort()) shape: (3, 1) ┌─────┐ │ a │ │ --- │ │ u32 │ ╞═════╡ │ 1 │ │ 0 │ │ 2 │ └─────┘