pandas.Series.notna¶
Detect existing (non-missing) values.
Return a boolean same-sized object indicating if the values are not NA.
Non-missing values get mapped to True. Characters such as empty
strings ''
or numpy.inf
are not considered NA values
(unless you set pandas.options.mode.use_inf_as_na = True
).
NA values, such as None or numpy.NaN
, get mapped to False
values.
- return
Series Mask of bool values for each element in Series that indicates whether an element is not an NA value.
Examples¶
Detect existing (non-missing) values.¶
import numpy as np
import pandas as pd
from numba import njit
@njit
def series_notna():
series = pd.Series([4, np.nan, 2, 1])
return series.notna() # Expect series of True, False, True, True
print(series_notna())
$ python ./series/series_notna.py
0 True
1 False
2 True
3 True
dtype: bool
See also
- Series.notnull
Alias of notna.
- Series.isna
Boolean inverse of notna.
- Series.dropna
Omit axes labels with missing values.
- pandas.absolute
Top-level notna.