pandas 1.4.2

ReturnsBackRef
notna(self) -> 'npt.NDArray[np.bool_]'

Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True . Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True ). NA values, such as None or numpy.NaN , get mapped to False values.

Returns

numpy.ndarray[bool]

Boolean array to indicate which entries are not NA.

Detect existing (non-missing) values.

See Also

Index.isna

Inverse of notna.

Index.notnull

Alias of notna.

notna

Top-level notna.

Examples

Show which entries in an Index are not NA. The result is an array.

This example is valid syntax, but we were not able to check execution
>>> idx = pd.Index([5.2, 6.0, np.NaN])
... idx Float64Index([5.2, 6.0, nan], dtype='float64')
This example is valid syntax, but we were not able to check execution
>>> idx.notna()
array([ True,  True, False])

Empty strings are not considered NA values. None is considered a NA value.

This example is valid syntax, but we were not able to check execution
>>> idx = pd.Index(['black', '', 'red', None])
... idx Index(['black', '', 'red', None], dtype='object')
This example is valid syntax, but we were not able to check execution
>>> idx.notna()
array([ True,  True,  True, False])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.indexes.base.Index.notna pandas.core.indexes.base.Index.isna pandas.core.dtypes.missing.notna

Local connectivity graph

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


File: /pandas/core/indexes/base.py#2735
type: <class 'function'>
Commit: