-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: Updated the docstring of pandas.Series.str.get #20630
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
Codecov Report
@@ Coverage Diff @@
## master #20630 +/- ##
==========================================
+ Coverage 91.82% 91.84% +0.02%
==========================================
Files 153 153
Lines 49256 49256
==========================================
+ Hits 45227 45241 +14
+ Misses 4029 4015 -14
Continue to review full report at Codecov.
|
|
||
Examples | ||
-------- | ||
>>> x = pd.Series(["String", (1, 2, 4), ["a", "b", "c"]]) |
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.
The standard way is to name the Series s
and not x
.
0 String | ||
1 (1, 2, 4) | ||
2 [a, b, c] | ||
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.
Can you add a numerical value, to show what happens.
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.
Since get
is a method for strings, I didn't add a numerical value (using one returns 'NaN'). However, it can be added it if you say.
0 t | ||
1 2 | ||
2 b | ||
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.
May be a example with a negative value too?
Extract element from lists, tuples, or strings in each element in the | ||
Series/Index. | ||
|
||
Parameters | ||
---------- | ||
i : int | ||
Integer index (location) | ||
Integer index (location). |
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.
I find this not very clear. May be something like "Position of the element to extract"?
@@ -1651,17 +1651,34 @@ def str_translate(arr, table, deletechars=None): | |||
|
|||
def str_get(arr, i): | |||
""" | |||
Extract element for each component. |
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.
That is not very clear. May be "Extract element from the specified position" or "Extract element from the specified position in a list or string" if not too long.
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.
Okay. How about, "Extract element for each component from the specified position." or "Extract the element from the specified position for all elements in Series."; something along those lines?
Hello! I accidentally deleted the original fork from which I had created this pull-request. I've generated a new request at – #20667 with the mentioned changes. I'm sorry for the trouble. |
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: