pyspark.pandas.isna¶
-
pyspark.pandas.
isna
(obj)¶ Detect missing values for an array-like object.
This function takes a scalar or array-like object and indicates whether values are missing (
NaN
in numeric arrays,None
orNaN
in object arrays).- Parameters
- objscalar or array-like
Object to check for null or missing values.
- Returns
- bool or array-like of bool
For scalar input, returns a scalar boolean. For array input, returns an array of boolean indicating whether each corresponding element is missing.
See also
Series.isna
Detect missing values in a Series.
Series.isnull
Detect missing values in a Series.
DataFrame.isna
Detect missing values in a DataFrame.
DataFrame.isnull
Detect missing values in a DataFrame.
Index.isna
Detect missing values in an Index.
Index.isnull
Detect missing values in an Index.
Examples
Scalar arguments (including strings) result in a scalar boolean.
>>> ps.isna('dog') False
>>> ps.isna(np.nan) True
ndarrays result in an ndarray of booleans.
>>> array = np.array([[1, np.nan, 3], [4, 5, np.nan]]) >>> array array([[ 1., nan, 3.], [ 4., 5., nan]]) >>> ps.isna(array) array([[False, True, False], [False, False, True]])
For Series and DataFrame, the same type is returned, containing booleans.
>>> df = ps.DataFrame({'a': ['ant', 'bee', 'cat'], 'b': ['dog', None, 'fly']}) >>> df a b 0 ant dog 1 bee None 2 cat fly
>>> ps.isna(df) a b 0 False False 1 False True 2 False False
>>> ps.isnull(df.b) 0 False 1 True 2 False Name: b, dtype: bool