cudf.DataFrame.notnull#
- DataFrame.notnull()[source]#
Identify non-missing values.
Return a boolean same-sized object indicating if the values are not
<NA>
. Non-missing values get mapped toTrue
.<NA>
values get mapped toFalse
values.<NA>
values include:Values where null mask is set.
NaN
in float dtype.NaT
in datetime64 and timedelta64 types.
Characters such as empty strings
''
orinf
in case of float are not considered<NA>
values.- Returns:
- DataFrame/Series/Index
Mask of bool values for each element in the object that indicates whether an element is not an NA value.
Examples
Show which entries in a DataFrame are NA.
>>> import cudf >>> import numpy as np >>> import pandas as pd >>> df = cudf.DataFrame({'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 toy 0 5 <NA> Alfred <NA> 1 6 1939-05-27 00:00:00.000000 Batman Batmobile 2 <NA> 1940-04-25 00:00:00.000000 Joker >>> df.notna() age born name toy 0 True False True False 1 True True True True 2 False True True True
Show which entries in a Series are NA.
>>> ser = cudf.Series([5, 6, np.nan, np.inf, -np.inf]) >>> ser 0 5.0 1 6.0 2 <NA> 3 Inf 4 -Inf dtype: float64 >>> ser.notna() 0 True 1 True 2 False 3 True 4 True dtype: bool
Show which entries in an Index are NA.
>>> idx = cudf.Index([1, 2, None, np.nan, 0.32, np.inf]) >>> idx Index([1.0, 2.0, <NA>, <NA>, 0.32, Inf], dtype='float64') >>> idx.notna() array([ True, True, False, False, True, True])