Pandas DataFrame: droplevel() function
DataFrame - droplevel() function
The droplevel() function is used to remove index / column level(s) from a given DataFrame.
Syntax:
DataFrame.droplevel(self, level, axis=0)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
level | If a string is given, must be the name of a level If list-like, elements must be names or positional indexes of levels. | int, str, or list-like | Required |
axis | {0 or ‘index’, 1 or ‘columns’} Default Value: 0 |
Required |
Returns: DataFrame.droplevel()
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame-interpolate() function
Next: DataFrame - pivot() 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