Spec-Zone.ru › Polars

polars.Series.explode

Series.explode(
    *,
    empty_as_null: bool | None = True,
    keep_nulls: bool = True,
) → Series

Explode a list Series.

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

Parameters:
empty_as_null

Explode an empty list into a null.

keep_nulls

Explode a null list into a null.

Returns:
Series

Series with the data type of the list elements.

See also

Series.list.explode

Explode a list 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(empty_as_null=False)
shape: (6,)
Series: 'a' [i64]
[
    1
    2
    3
    4
    5
    6
]

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.explode.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API