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
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://www.w3resource.com/pandas/dataframe/dataframe-dropna.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics