polars.Series.list.join#

Series.list.join(separator: IntoExprColumn, *, ignore_nulls: bool = True) Series[source]#

Join all string items in a sublist and place a separator between them.

This errors if inner type of list != String.

Parameters:
separator

string to separate the items with

ignore_nulls

Ignore null values (default).

If set to False, null values will be propagated. If the sub-list contains any null values, the output is None.

Returns:
Series

Series of data type String.

Examples

>>> s = pl.Series([["foo", "bar"], ["hello", "world"]])
>>> s.list.join(separator="-")
shape: (2,)
Series: '' [str]
[
    "foo-bar"
    "hello-world"
]