polars.Expr.arr.to_list#

Expr.arr.to_list() Expr[source]#

Convert an Array column into a List column with the same inner data type.

Returns:
Expr

Expression of data type List.

Examples

>>> df = pl.DataFrame(
...     data={"a": [[1, 2], [3, 4]]},
...     schema={"a": pl.Array(inner=pl.Int8, width=2)},
... )
>>> df.select(pl.col("a").arr.to_list())
shape: (2, 1)
┌──────────┐
│ a        │
│ ---      │
│ list[i8] │
╞══════════╡
│ [1, 2]   │
│ [3, 4]   │
└──────────┘