pyspark.pandas.Series.dropna

Series.dropna(axis: Union[int, str] = 0, inplace: bool = False, **kwargs: Any) → Optional[pyspark.pandas.series.Series]

Return a new Series with missing values removed.

Parameters
axis{0 or ‘index’}, default 0

There is only one axis to drop values from.

inplacebool, default False

If True, do operation inplace and return None.

**kwargs

Not in use.

Returns
Series

Series with NA entries dropped from it.

Examples

>>> ser = ps.Series([1., 2., np.nan])
>>> ser
0    1.0
1    2.0
2    NaN
dtype: float64

Drop NA values from a Series.

>>> ser.dropna()
0    1.0
1    2.0
dtype: float64

Keep the Series with valid entries in the same variable.

>>> ser.dropna(inplace=True)
>>> ser
0    1.0
1    2.0
dtype: float64