isna(obj)
This function takes a scalar or array-like object and indicates whether values are missing ( NaN
in numeric arrays, None
or NaN
in object arrays, NaT
in datetimelike).
Object to check for null or missing values.
For scalar input, returns a scalar boolean. For array input, returns an array of boolean indicating whether each corresponding element is missing.
Detect missing values for an array-like object.
DataFrame.isna
Detect missing values in a DataFrame.
Index.isna
Detect missing values in an Index.
Series.isna
Detect missing values in a Series.
notna
Boolean inverse of pandas.isna.
Scalar arguments (including strings) result in a scalar boolean.
This example is valid syntax, but we were not able to check execution>>> pd.isna('dog') FalseThis example is valid syntax, but we were not able to check execution
>>> pd.isna(pd.NA) TrueThis example is valid syntax, but we were not able to check execution
>>> pd.isna(np.nan) True
ndarrays result in an ndarray of booleans.
This example is valid syntax, but we were not able to check execution>>> array = np.array([[1, np.nan, 3], [4, 5, np.nan]])This example is valid syntax, but we were not able to check execution
... array array([[ 1., nan, 3.], [ 4., 5., nan]])
>>> pd.isna(array) array([[False, True, False], [False, False, True]])
For indexes, an ndarray of booleans is returned.
This example is valid syntax, but we were not able to check execution>>> index = pd.DatetimeIndex(["2017-07-05", "2017-07-06", None,This example is valid syntax, but we were not able to check execution
... "2017-07-08"])
... index DatetimeIndex(['2017-07-05', '2017-07-06', 'NaT', '2017-07-08'], dtype='datetime64[ns]', freq=None)
>>> pd.isna(index) array([False, False, True, False])
For Series and DataFrame, the same type is returned, containing booleans.
This example is valid syntax, but we were not able to check execution>>> df = pd.DataFrame([['ant', 'bee', 'cat'], ['dog', None, 'fly']])This example is valid syntax, but we were not able to check execution
... df 0 1 2 0 ant bee cat 1 dog None fly
>>> pd.isna(df) 0 1 2 0 False False False 1 False True FalseThis example is valid syntax, but we were not able to check execution
>>> pd.isna(df[1]) 0 False 1 True Name: 1, dtype: boolSee :
The following pages refer to to this document either explicitly or contain code examples using this.
pandas.core.dtypes.missing.notna
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them