polars.Expr.is_in
-
Проверяет, присутствуют ли элементы этого выражения в другой Series.
- Параметры:
-
- other
-
Series или последовательность примитивного типа.
-
nulls_equalbool, default False -
Если True, считать null отдельным значением. Значения null не будут распространяться.
- Возвращает:
-
- Expr
-
Выражение типа данных
Boolean.
Примеры
>>> df = pl.DataFrame( ... {"sets": [[1, 2, 3], [1, 2], [9, 10]], "optional_members": [1, 2, 3]} ... ) >>> df.with_columns(contains=pl.col("optional_members").is_in("sets")) shape: (3, 3) ┌───────────┬──────────────────┬──────────┐ │ sets ┆ optional_members ┆ contains │ │ --- ┆ --- ┆ --- │ │ list[i64] ┆ i64 ┆ bool │ ╞═══════════╪══════════════════╪══════════╡ │ [1, 2, 3] ┆ 1 ┆ true │ │ [1, 2] ┆ 2 ┆ true │ │ [9, 10] ┆ 3 ┆ false │ └───────────┴──────────────────┴──────────┘
Expr.is_in(
other: Expr | Collection[Any] | Series,
*,
nulls_equal: bool = False,
) → Expr
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.is_in.html