pyspark.pandas.Series.explode

Series.explode() → pyspark.pandas.series.Series

Transform each element of a list-like to a row.

Returns
Series

Exploded lists to rows; index will be duplicated for these rows.

See also

Series.str.split

Split string values on specified separator.

Series.unstack

Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame.

DataFrame.melt

Unpivot a DataFrame from wide format to long format.

DataFrame.explode

Explode a DataFrame from list-like columns to long format.

Examples

>>> psser = ps.Series([[1, 2, 3], [], [3, 4]])
>>> psser
0    [1, 2, 3]
1           []
2       [3, 4]
dtype: object
>>> psser.explode()  
0    1.0
0    2.0
0    3.0
1    NaN
2    3.0
2    4.0
dtype: float64