Pandas Series: explode() function

Explode list-likes including lists, tuples, Series, and np.ndarray

The explode() function is used to transform each element of a list-like to a row, replicating the index values.


Series.explode(self) → 'Series'
Pandas Series explode image

Returns: Series- Exploded lists to rows; index will be duplicated for these rows.


This routine will explode list-likes including lists, tuples, Series, and np.ndarray. The result dtype of the subset rows will be object. Scalars will be returned unchanged. Empty list-likes will result in a np.nan for that row.


Download the above Notebook from here.

Previous: Series-unstack() function
Next: Find indices where elements should be inserted to maintain order