Spec-Zone.ru › Polars

polars.DataFrame.is_sorted

DataFrame.is_sorted(
    by: str | Iterable[str],
    *more_by: str,
    descending: bool | Sequence[bool] = False,
    nulls_last: bool | Sequence[bool] = False,
) → bool

Check whether the DataFrame is sorted by the given columns.

Parameters:
by

Column name(s) to check.

*more_by

Additional column names.

descending

Sort in descending order. When sorting by multiple columns, can be specified per column by passing a sequence of booleans.

nulls_last

Place null values last. When sorting by multiple columns, can be specified per column by passing a sequence of booleans.

Examples

>>> df = pl.DataFrame({"a": [1, 2, 3], "b": [5, 4, 3]})
>>> df.is_sorted("a")
True
>>> df.is_sorted("b", descending=True)
True
>>> df.is_sorted("a", "b")
True

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

Spec-Zone.ru

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