Search code examples
pythonpython-polars

Polars selector for columns of dtype pl.List


In the polars documentation regarding selectors, there are many examples for selecting columns based on their dtypes. I am missing pl.List

How can I quickly select all columns of type pl.List within a pl.DataFrame?


Solution

  • At the moment it's not possible to select all lists with selectors, but if you have lists of specific type, you can do it:

    df.select(cs.by_dtype(pl.List(pl.Int64)))