polars.Series.list.explode
-
Returns a column with a separate row for every list element.
- Parameters:
-
- empty_as_null
-
Explode an empty list into a
null. - keep_nulls
-
Explode a
nulllist into anull.
- Returns:
-
- Series
-
Series with the data type of the list elements.
See also
-
Series.reshape -
Reshape this Series to a flat Series or a Series of Lists.
Examples
>>> s = pl.Series("a", [[1, 2, 3], [4, 5, 6]]) >>> s.list.explode(empty_as_null=False) shape: (6,) Series: 'a' [i64] [ 1 2 3 4 5 6 ]
Series.list.explode(
*,
empty_as_null: bool | None = None,
keep_nulls: bool = True,
) → Series
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.list.explode.html