Pandas DataFrame: explode() function

DataFrame - explode() function

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


DataFrame.explode(self, column: Union[str, Tuple]) → 'DataFrame'


Name Description Type/Default Value Required / Optional
column     str or tuple Required

Returns: DataFrame
Exploded lists to rows of the subset columns; index will be duplicated for these rows.

Raises: ValueError - if columns of the frame are not unique.


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - melt() function
Next: DataFrame - squeeze() function

Follow us on Facebook and Twitter for latest update.