Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Index.isna#

finalIndex.isna()[source]#

Detect missing values.

Return a boolean same-sized object indicating if the values are NA.NA values, such asNone,numpy.NaN orpd.NaT, getmapped toTrue values.Everything else get mapped toFalse values. Characters such asempty strings‘’ ornumpy.inf are not considered NA values.

Returns:
numpy.ndarray[bool]

A boolean array of whether my values are NA.

See also

Index.notna

Boolean inverse of isna.

Index.dropna

Omit entries with missing values.

isna

Top-level isna.

Series.isna

Detect missing values in Series object.

Examples

Show which entries in a pandas.Index are NA. The result is anarray.

>>>idx=pd.Index([5.2,6.0,np.nan])>>>idxIndex([5.2, 6.0, nan], dtype='float64')>>>idx.isna()array([False, False,  True])

Empty strings are not considered NA values. None is considered an NAvalue.

>>>idx=pd.Index(['black','','red',None])>>>idxIndex(['black', '', 'red', None], dtype='object')>>>idx.isna()array([False, False, False,  True])

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])>>>idxDatetimeIndex(['1940-04-25', 'NaT', 'NaT', 'NaT'],              dtype='datetime64[ns]', freq=None)>>>idx.isna()array([False,  True,  True,  True])

[8]ページ先頭

©2009-2025 Movatter.jp