@@ -2148,18 +2148,58 @@ def hasnans(self):
2148
2148
2149
2149
def isna (self ):
2150
2150
"""
2151
- Detect missing values
2151
+ Detect missing values.
2152
+
2153
+ Return a boolean same-sized object indicating if the values are NA.
2154
+ NA values, such as ``None``, :attr:`numpy.NaN` or :attr:`pd.NaT`, get
2155
+ mapped to ``True`` values.
2156
+ Everything else get mapped to ``False`` values. Characters such as
2157
+ empty strings `''` or :attr:`numpy.inf` are not considered NA values
2158
+ (unless you set :attr:`pandas.options.mode.use_inf_as_na` `= True`).
2152
2159
2153
2160
.. versionadded:: 0.20.0
2154
2161
2155
2162
Returns
2156
2163
-------
2157
- a boolean array of whether my values are NA
2164
+ numpy.ndarray
2165
+ A boolean array of whether my values are NA
2158
2166
2159
- See also
2167
+ See Also
2160
2168
--------
2161
- isnull : alias of isna
2162
- pandas.isna : top-level isna
2169
+ pandas.Index.notna : boolean inverse of isna.
2170
+ pandas.Index.dropna : omit entries with missing values.
2171
+ pandas.isna : top-level isna.
2172
+ Series.isna : detect missing values in Series object.
2173
+
2174
+ Examples
2175
+ --------
2176
+ Show which entries in a pandas.Index are NA. The result is an
2177
+ array.
2178
+
2179
+ >>> idx = pd.Index([5.2, 6.0, np.NaN])
2180
+ >>> idx
2181
+ Float64Index([5.2, 6.0, nan], dtype='float64')
2182
+ >>> idx.isna()
2183
+ array([False, False, True], dtype=bool)
2184
+
2185
+ Empty strings are not considered NA values. None is considered an NA
2186
+ value.
2187
+
2188
+ >>> idx = pd.Index(['black', '', 'red', None])
2189
+ >>> idx
2190
+ Index(['black', '', 'red', None], dtype='object')
2191
+ >>> idx.isna()
2192
+ array([False, False, False, True], dtype=bool)
2193
+
2194
+ For datetimes, `NaT` (Not a Time) is considered as an NA value.
2195
+
2196
+ >>> idx = pd.DatetimeIndex([pd.Timestamp('1940-04-25'),
2197
+ ... pd.Timestamp(''), None, pd.NaT])
2198
+ >>> idx
2199
+ DatetimeIndex(['1940-04-25', 'NaT', 'NaT', 'NaT'],
2200
+ dtype='datetime64[ns]', freq=None)
2201
+ >>> idx.isna()
2202
+ array([False, True, True, True], dtype=bool)
2163
2203
"""
2164
2204
return self ._isnan
2165
2205
isnull = isna
0 commit comments