Spec-Zone.ru › Polars

polars.Expr.set_sorted

Expr.set_sorted(
    *,
    descending: bool = False,
    nulls_last: bool = False,
) → Expr

Flags the expression as ‘sorted’.

Enables downstream code to user fast paths for sorted arrays. It is recommended to also set whether nulls_last is True or False, as this enables many internal optimizations.

engine:In MemoryStreamingDistributed
Parameters:
descending

Whether the Series order is descending.

nulls_last

Whether the nulls are at the end.

Warning

This can lead to incorrect results if the data is NOT sorted!! Use with care!

Examples

>>> df = pl.DataFrame({"values": [1, 2, 3]})
>>> df.select(pl.col("values").set_sorted().max())
shape: (1, 1)
┌────────┐
│ values │
│ ---    │
│ i64    │
╞════════╡
│ 3      │
└────────┘

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.set_sorted.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API