Skip to content

Commit b547454

Browse files
Donk23TomAugspurger
authored andcommitted
DOC: update the pandas.DataFrame.isna and pandas.Series.isna docstring (#20138)
1 parent 1837929 commit b547454

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

pandas/core/generic.py

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5585,13 +5585,63 @@ def asof(self, where, subset=None):
55855585
# Action Methods
55865586

55875587
_shared_docs['isna'] = """
5588+
Detect missing values.
5589+
55885590
Return a boolean same-sized object indicating if the values are NA.
5591+
NA values, such as None or :attr:`numpy.NaN`, gets mapped to True
5592+
values.
5593+
Everything else gets mapped to False values. Characters such as empty
5594+
strings `''` or :attr:`numpy.inf` are not considered NA values
5595+
(unless you set ``pandas.options.mode.use_inf_as_na = True``).
5596+
5597+
Returns
5598+
-------
5599+
%(klass)s
5600+
Mask of bool values for each element in %(klass)s that
5601+
indicates whether an element is not an NA value.
55895602
55905603
See Also
55915604
--------
5592-
%(klass)s.notna : boolean inverse of isna
55935605
%(klass)s.isnull : alias of isna
5606+
%(klass)s.notna : boolean inverse of isna
5607+
%(klass)s.dropna : omit axes labels with missing values
55945608
isna : top-level isna
5609+
5610+
Examples
5611+
--------
5612+
Show which entries in a DataFrame are NA.
5613+
5614+
>>> df = pd.DataFrame({'age': [5, 6, np.NaN],
5615+
... 'born': [pd.NaT, pd.Timestamp('1939-05-27'),
5616+
... pd.Timestamp('1940-04-25')],
5617+
... 'name': ['Alfred', 'Batman', ''],
5618+
... 'toy': [None, 'Batmobile', 'Joker']})
5619+
>>> df
5620+
age born name toy
5621+
0 5.0 NaT Alfred None
5622+
1 6.0 1939-05-27 Batman Batmobile
5623+
2 NaN 1940-04-25 Joker
5624+
5625+
>>> df.isna()
5626+
age born name toy
5627+
0 False True False True
5628+
1 False False False False
5629+
2 True False False False
5630+
5631+
Show which entries in a Series are NA.
5632+
5633+
>>> ser = pd.Series([5, 6, np.NaN])
5634+
>>> ser
5635+
0 5.0
5636+
1 6.0
5637+
2 NaN
5638+
dtype: float64
5639+
5640+
>>> ser.isna()
5641+
0 False
5642+
1 False
5643+
2 True
5644+
dtype: bool
55955645
"""
55965646

55975647
@Appender(_shared_docs['isna'] % _shared_doc_kwargs)

0 commit comments

Comments
 (0)