-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Updated the docstring of pandas.Series.str.get #20667
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
Conversation
pandas/core/strings.py
Outdated
1 2 | ||
2 b | ||
3 NaN | ||
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.
Looks good. May be we could a dictionary to the Series
too, and an example indexing by a negative number. I'm not sure, as the example could be too complex for the simplicity of the function. But it'd illustrate the different behaviors.
It'd also help to have an explanation before the example, saying something like "When the value is not an iterable, or a dict where the index is not in the keys, str.get
returns NaN
".
If you do it you may encounter this bug: #20671. I'd wait until it's fixed, otherwise you'd have to use an index that is a key in the dictionary, and not illustrate the case when the index is not a key, which raises a KeyError
right now.
Hello @datapythonista! I see that you've fixed the bug (which I tried fixing, but your solution is a lot better). Should I proceed writing the docstring with a dictionary & a negative value? |
You can add it, yes. My changes are not merged, so when you run the validation script you'll get the doctest fail, but no problem with that, when the bug is fixed your doctest will pass and your PR could be merged. |
Added an example with a dictionary, a negative integer and an example with a negative index, i.e., not present in the dictionary.
Hello @pranavsuri! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on April 24, 2018 at 09:56 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #20667 +/- ##
==========================================
+ Coverage 91.81% 91.83% +0.02%
==========================================
Files 153 153
Lines 49270 49318 +48
==========================================
+ Hits 45238 45293 +55
+ Misses 4032 4025 -7
Continue to review full report at Codecov.
|
@pranavsuri, Can you fix the PEP-8 issues? Besides that lgtm. But it needs to wait until #20671 is merged. |
thanks @pranavsuri |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Please include the output of the validation script below between the "```" ticks: