polars.Series.explode#

Series.explode() Series[source]#

Explode a list Series.

This means that every item is expanded to a new row.

Returns:
Series

Series with the data type of the list elements.

See also

Series.list.explode

Explode a list column.

Series.str.explode

Explode a string column.

Examples

>>> s = pl.Series("a", [[1, 2, 3], [4, 5, 6]])
>>> s
shape: (2,)
Series: 'a' [list[i64]]
[
        [1, 2, 3]
        [4, 5, 6]
]
>>> s.explode()
shape: (6,)
Series: 'a' [i64]
[
        1
        2
        3
        4
        5
        6
]