polars.Series.filter
-
Фильтрует элементы с помощью булевой маски.
Исходный порядок оставшихся элементов сохраняется.
Элементы, для которых результат фильтра не равен 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 ]
Series.filter(
predicate: Series | Iterable[bool],
) → Self
© 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