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.
Syntax:
DataFrame.explode(self, column: Union[str, Tuple]) → 'DataFrame'
Parameters:
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.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - melt() function
Next: DataFrame - squeeze() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/pandas/dataframe/dataframe-explode.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics