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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework