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