bigframes.pandas.DataFrame.isna#
- DataFrame.isna() DataFrame[source]#
Detect missing (NULL) values.
Return a boolean same-sized object indicating if the values are NA (NULL in BigQuery). NA/NULL values get mapped to True values. Everything else gets mapped to False values.
Note that empty strings
'',numpy.inf, andnumpy.nanare *not* considered NA values. This NA/NULL logic differs from numpy, but it is the same as BigQuery and thepandas.ArrowDtype.Examples:
>>> df = bpd.DataFrame(dict( ... age=pd.Series(pa.array( ... [5, 6, None, 4], ... type=pa.int64(), ... ), dtype=pd.ArrowDtype(pa.int64())), ... born=pd.to_datetime([pd.NA, "1940-04-25", "1940-04-25", "1941-08-25"]), ... name=['Alfred', 'Batman', '', 'Plastic Man'], ... toy=[None, 'Batmobile', 'Joker', 'Play dough'], ... height=pd.Series(pa.array( ... [6.1, 5.9, None, np.nan], ... type=pa.float64(), ... ), dtype=pd.ArrowDtype(pa.float64())), ... )) >>> df age born name toy height 0 5 <NA> Alfred <NA> 6.1 1 6 1940-04-25 00:00:00 Batman Batmobile 5.9 2 <NA> 1940-04-25 00:00:00 Joker <NA> 3 4 1941-08-25 00:00:00 Plastic Man Play dough NaN [4 rows x 5 columns]
Show which entries in a DataFrame are NA (NULL in BigQuery):
>>> df.isna() age born name toy height 0 False True False True False 1 False False False False False 2 True False False False True 3 False False False False False [4 rows x 5 columns]
>>> df.isnull() age born name toy height 0 False True False True False 1 False False False False False 2 True False False False True 3 False False False False False [4 rows x 5 columns]
Show which entries in a Series are NA (NULL in BigQuery):
>>> ser = bpd.Series(pa.array( ... [5, None, 6, np.nan, None], ... type=pa.float64(), ... ), dtype=pd.ArrowDtype(pa.float64())) >>> ser 0 5.0 1 <NA> 2 6.0 3 NaN 4 <NA> dtype: Float64
>>> ser.isna() 0 False 1 True 2 False 3 False 4 True dtype: boolean
>>> ser.isnull() 0 False 1 True 2 False 3 False 4 True dtype: boolean
- Returns:
Mask of bool values for each element that indicates whether an element is an NA value.
- Return type: