polars.Expr.explode

Expr.explode() polars.internals.expr.Expr

Explode a list or utf8 Series. This means that every item is expanded to a new row.

Returns
Exploded Series of same dtype

Examples

>>> df = pl.DataFrame({"b": [[1, 2, 3], [4, 5, 6]]})
>>> df.select(pl.col("b").explode())
shape: (6, 1)
┌─────┐
│ b   │
│ --- │
│ i64 │
╞═════╡
│ 1   │
├╌╌╌╌╌┤
│ 2   │
├╌╌╌╌╌┤
│ 3   │
├╌╌╌╌╌┤
│ 4   │
├╌╌╌╌╌┤
│ 5   │
├╌╌╌╌╌┤
│ 6   │
└─────┘