-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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 iteritems docstring update and examples #22658
Merged
jorisvandenbossche
merged 12 commits into
pandas-dev:master
from
Ecboxer:shiny-new-feature
Sep 27, 2018
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0521552
DOC
Ecboxer 5447a1f
Continuation lines start with ... and are aligned, reverted descripti…
Ecboxer 8ccd554
Removed trailing space and added Returns/Yields section
Ecboxer fcc27e8
Added extended summary
Ecboxer 6dad21c
Edits to long description, split Yields section into label and conten…
Ecboxer 25da7f8
Merge remote-tracking branch 'upstream/master' into shiny-new-feature
Ecboxer 30026a4
Changed pop to population and reformatted example
Ecboxer 5110b7c
Changed pop to population in example output
Ecboxer 76243b3
Changed docstring to string literal and removed escape chars
Ecboxer 1b52a08
Removed end="\n"
Ecboxer 618318c
Shortened example, fit long desc to char limit, changed Yields to des…
Ecboxer d8e5370
Returned to two part Yields section, label and contents
Ecboxer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@datapythonista I think in this case, the above is actually a bit confusing. Typically, we use the formatting above if there are actually two return values (so if you could do
label, content = df.iteritems()
), which is not the case here.So I think the original single item was better, but we could try to make it clearer that it the values of the iterator consist of those two items.
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.
Looks clear to me, not sure why it doesn't to you. In this case you can do
for label, content in df.iteritems():
which is equivalent to what you said.Not a big deal changing this to a
Returns
saying it's a generator returning tuples. But I don't think that would be clearer to me, and feels a bit inconsistent.What do you think is clearer for you @Ecboxer? Also, may be @WillAyd want to give an opinion, and he's doing a lot with the docstrings? Happy with whatever option is clearer to most people.
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.
Let me know what you think of the rephrased it under Yields. It may be too wordy?
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.
for label, content in df.iteritems()
is not the same aslabel, content = df.iteritems()
..The thing is that otherwise we are using the same visual formatting to mean two different things. I would prefer that a user can know from the return type if there is a single or multiple return values (but maybe I am overestimating our users?)
We can maybe still combine both, something like:
or does that only make it more complicated?
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.
Ah sorry, I missed that it was a "Yields" section, and not a "Returns" section. In that case, it is correct that it yields two values in each iteration! (and how you did it here is consistent with the numpydoc guidelines)
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.
@Ecboxer sorry, you can change it back to how it was before I commented :-)
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.
hehe, I see what you meant now. Cool then. :)
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.
Changed it back :)