Spec-Zone.ru › Polars

polars.Series.filter

Series.filter(
    predicate: Series | Iterable[bool],
) → Self

Фильтрует элементы с помощью булевой маски.

Исходный порядок оставшихся элементов сохраняется.

Элементы, для которых результат фильтра не равен True, отбрасываются, включая null.

Параметры:
predicate

Булева маска.

Примеры

>>> s = pl.Series("a", [1, 2, 3])
>>> mask = pl.Series("", [True, False, True])
>>> s.filter(mask)
shape: (2,)
Series: 'a' [i64]
[
    1
    3
]

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

Spec-Zone.ru

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