Pandas DataFrame: dropna() function
DataFrame-dropna() function
The dropna() function is used to remove missing values.
Syntax:
DataFrame.dropna(self, axis=0, how='any', thresh=None, subset=None, inplace=False)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
axis | Determine if rows or columns which contain missing values are removed.
|
{0 or ‘index’, 1 or ‘columns’} Default Value: 0 |
Required |
how | Determine if row or column is removed from DataFrame, when we have at least one NA or all NA.
|
{‘any’, ‘all’} Default Value: ‘any’ |
Required |
thresh | Require that many non-NA values. | int | Optional |
subset | Labels along other axis to consider, e.g. if you are dropping rows these would be a list of columns to include. | array-like | Optional |
inplace | If True, do operation inplace and return None. | bool Default Value: False |
Required |
Returns: DataFrame
DataFrame with NA entries dropped from it.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - take() function
Next: DataFrame-fillna() 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