Skip to content
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

Merged
merged 3 commits into from
May 26, 2023

Conversation

DeaMariaLeon
Copy link
Member

Towards #37875

@DeaMariaLeon DeaMariaLeon added this to the 2.1 milestone May 26, 2023
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Comment on lines +6340 to +6342
>>> 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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 nice example

Copy link
Member Author

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. :-)


Examples
--------
>>> idx = pd.Index([None, np.nan, 3])
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure


Examples
--------
>>> idx = pd.Index([1, None, 3])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - thanks

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @DeaMariaLeon !

@MarcoGorelli MarcoGorelli merged commit 10ef2ef into pandas-dev:main May 26, 2023
34 checks passed
@DeaMariaLeon DeaMariaLeon deleted the examplesMay26 branch May 26, 2023 16:23
topper-123 pushed a commit to topper-123/pandas that referenced this pull request Jun 5, 2023
* NA, InvalidVersion, & Index examples

* Changed None to np.nan
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* NA, InvalidVersion, & Index examples

* Changed None to np.nan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants