Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.DataFrame.isna#

DataFrame.isna()[source]#

Detect missing values.

Return a boolean same-sized object indicating if the values are NA.NA values, such as None ornumpy.NaN, gets mapped to Truevalues.Everything else gets mapped to False values. Characters such as emptystrings'' ornumpy.inf are not considered NA values(unless you setpandas.options.mode.use_inf_as_na=True).

Returns:
DataFrame

Mask of bool values for each element in DataFrame thatindicates whether an element is an NA value.

See also

DataFrame.isnull

Alias of isna.

DataFrame.notna

Boolean inverse of isna.

DataFrame.dropna

Omit axes labels with missing values.

isna

Top-level isna.

Examples

Show which entries in a DataFrame are NA.

>>>df=pd.DataFrame(dict(age=[5,6,np.nan],...born=[pd.NaT,pd.Timestamp('1939-05-27'),...pd.Timestamp('1940-04-25')],...name=['Alfred','Batman',''],...toy=[None,'Batmobile','Joker']))>>>df   age       born    name        toy0  5.0        NaT  Alfred       None1  6.0 1939-05-27  Batman  Batmobile2  NaN 1940-04-25              Joker
>>>df.isna()     age   born   name    toy0  False   True  False   True1  False  False  False  False2   True  False  False  False

Show which entries in a Series are NA.

>>>ser=pd.Series([5,6,np.nan])>>>ser0    5.01    6.02    NaNdtype: float64
>>>ser.isna()0    False1    False2     Truedtype: bool

[8]ページ先頭

©2009-2025 Movatter.jp