Код: Выделить всё
import polars as pl
df = pl.DataFrame({"list_column": [[1, 2], [3, 4], [5, 6]]})
Код: Выделить всё
df.with_columns(type_check = pl.lit((pl.col("list_column").shrink_dtype() == pl.List)))
Код: Выделить всё
shape: (3, 2)
┌─────────────┬────────────┐
│ list_column ┆ type_check │
│ --- ┆ --- │
│ list[i64] ┆ bool │
╞═════════════╪════════════╡
│ [1, 2] ┆ true │
│ [3, 4] ┆ true │
│ [5, 6] ┆ true │
└─────────────┴────────────┘
Подробнее здесь: https://stackoverflow.com/questions/794 ... expression