polars.Expr.arr.contains#
- Expr.arr.contains(item: float | str | bool | int | date | datetime | time | Expr) Expr [source]#
Check if sublists contain the given item.
- Parameters:
- item
Item that will be checked for membership
- Returns:
- Boolean mask
Examples
>>> df = pl.DataFrame({"foo": [[3, 2, 1], [], [1, 2]]}) >>> df.select(pl.col("foo").arr.contains(1)) shape: (3, 1) ┌───────┐ │ foo │ │ --- │ │ bool │ ╞═══════╡ │ true │ │ false │ │ true │ └───────┘