-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: update the pandas.Series.str.strip docstring #20628
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 #20628 +/- ##
==========================================
+ Coverage 91.82% 91.82% +<.01%
==========================================
Files 153 153
Lines 49256 49256
==========================================
+ Hits 45227 45229 +2
+ Misses 4029 4027 -2
Continue to review full report at Codecov.
|
String or unicode to strip in the given string. | ||
|
||
Examples | ||
-------- |
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.
Examples
section goes after Returns
|
||
Examples | ||
-------- | ||
>>> # strip method |
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.
You can write sentences explaining what you're doing without making then Python comments. Check the docstring guide or other docstrings already improved.
Examples | ||
-------- | ||
>>> # strip method | ||
>>> s = pd.Series([' This is a Test 1 ']) |
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'd create a single Series with all the values you want to use in the examples, and then apply all operations to it.
@@ -2094,8 +2094,46 @@ def encode(self, encoding, errors="strict"): | |||
return self._wrap_result(result) | |||
|
|||
_shared_docs['str_strip'] = (""" | |||
Strip whitespace (including newlines) from each string in the | |||
Series/Index from %(side)s. Equivalent to :meth:`str.%(method)s`. | |||
Strip whitespaces from string in Series. |
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.
Not necessarily whitespaces.
Seems like #20863 is also fixing the same docstring, and IMO looks better. I think we can close this one. |
Thanks @techedlaksh. Unfortunately it appears that there was some overlap with #20863; sorry about that. Feel free to work on other docstrings, always appreciated! |
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: