-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
DOC: Fixing EX01 - Added examples #53403
Conversation
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.
nice!
>>> idx = pd.Index([1, 2, 3]) | ||
>>> idx.map('I am a {}'.format) | ||
Index(['I am a 1', 'I am a 2', 'I am a 3'], dtype='object') |
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.
😆 nice example
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.
There was something similar already in the docs. I stole it. :-)
pandas/core/indexes/base.py
Outdated
|
||
Examples | ||
-------- | ||
>>> idx = pd.Index([None, np.nan, 3]) |
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.
although you're constructing with None
and np.nan
, they both get converted to np.nan
In [2]: pd.Index([None, np.nan, 3])
Out[2]: Index([nan, nan, 3.0], dtype='float64')
To reduce the chance for confusion, shall we just construct with np.nan
directly?
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.
Sure
pandas/core/indexes/base.py
Outdated
|
||
Examples | ||
-------- | ||
>>> idx = pd.Index([1, None, 3]) |
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.
same here
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.
Yes - thanks
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.
thanks @DeaMariaLeon !
* NA, InvalidVersion, & Index examples * Changed None to np.nan
* NA, InvalidVersion, & Index examples * Changed None to np.nan
Towards #37875