Index.isna(self)
[source]
Detect missing values.
Return a boolean same-sized object indicating if the values are NA. NA values, such as None
, numpy.NaN
or pd.NaT
, get mapped to True
values. Everything else get mapped to False
values. Characters such as empty strings ‘’
or numpy.inf
are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True
).
New in version 0.20.0.
Returns: |
|
---|
See also
Index.notna
Index.dropna
isna
Series.isna
Show which entries in a pandas.Index are NA. The result is an array.
>>> idx = pd.Index([5.2, 6.0, np.NaN]) >>> idx Float64Index([5.2, 6.0, nan], dtype='float64') >>> idx.isna() array([False, False, True], dtype=bool)
Empty strings are not considered NA values. None is considered an NA value.
>>> idx = pd.Index(['black', '', 'red', None]) >>> idx Index(['black', '', 'red', None], dtype='object') >>> idx.isna() array([False, False, False, True], dtype=bool)
For datetimes, NaT
(Not a Time) is considered as an NA value.
>>> idx = pd.DatetimeIndex([pd.Timestamp('1940-04-25'), ... pd.Timestamp(''), None, pd.NaT]) >>> idx DatetimeIndex(['1940-04-25', 'NaT', 'NaT', 'NaT'], dtype='datetime64[ns]', freq=None) >>> idx.isna() array([False, True, True, True], dtype=bool)
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Index.isna.html