-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Update the pandas.Index.isna docstring #20123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
31b80ae
c25704f
d42569d
87fb1e2
df734c8
6e859ba
60f627b
3f23997
195421e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2022,18 +2022,48 @@ def hasnans(self): | |
|
||
def isna(self): | ||
""" | ||
Detect missing values | ||
Detect missing values. | ||
|
||
Return a boolean same-sized object indicating if the values are NA. | ||
NA values, such as None or :attr:`numpy.NaN`, get mapped to True | ||
values. | ||
Everything else get mapped to False values. Characters such as empty | ||
strings `''` or :attr:`numpy.inf` are not considered NA values | ||
(unless you set :attr:`pandas.options.mode.use_inf_as_na` `= True`). | ||
|
||
.. versionadded:: 0.20.0 | ||
|
||
Returns | ||
------- | ||
a boolean array of whether my values are NA | ||
numpy.ndarray | ||
A boolean array of whether my values are NA | ||
|
||
See also | ||
-------- | ||
isnull : alias of isna | ||
pandas.Index.isnull : alias of isna | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could say this is a synonym There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not my native language, I went with the language that was originally used. I can change it across all docs we have commited fi you'd like to, @jreback . Y/N? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh sorry, yes alias is fine. |
||
pandas.Index.notna : boolean inverse of isna | ||
pandas.Index.dropna : omit entries with missing values | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add Series.isna |
||
pandas.isna : top-level isna | ||
|
||
Examples | ||
-------- | ||
Show which entries in a pandas.Index are NA. The result is a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a -> an. array to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We left it as 'array', because you can see the data type in the returns section (recommended as more user friendly by @jorisvandenbossche ) |
||
array. | ||
|
||
>>> idx = pd.Index([5.2, 6.0, np.NaN]) | ||
>>> idx | ||
Float64Index([5.2, 6.0, nan], dtype='float64') | ||
>>> idx.isna() | ||
array([False, False, True]) | ||
|
||
Empty strings are not considered NA values. None is considered a NA | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a -> an. |
||
value. | ||
|
||
>>> idx = pd.Index(['black', '', 'red', None]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you show a datetimeindex example (with has a NaT) |
||
>>> idx | ||
Index(['black', '', 'red', None], dtype='object') | ||
>>> idx.isna() | ||
array([False, False, False, True]) | ||
""" | ||
return self._isnan | ||
isnull = isna | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or
pd.NaT