Skip to content

DOC:GH34026 #34059

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

Merged
merged 5 commits into from
May 16, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2977,8 +2977,6 @@ def encode(self, encoding, errors="strict"):
_shared_docs[
"str_strip"
] = r"""
Remove leading and trailing characters.
Copy link
Member

Choose a reason for hiding this comment

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

It might be simpler to add a substitution here, something like

Suggested change
Remove leading and trailing characters.
Remove %(position)s characters.

and then, at the top of the def of lstrip, inside dict, add position="leading" (and similarly "trailing" for rstrip)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha, I see. Ok, I'll fix those then commit again. ty!


Strip whitespaces (including newlines) or a set of specified characters
from each string in the Series/Index from %(side)s.
Equivalent to :meth:`str.%(method)s`.
Expand Down Expand Up @@ -3050,12 +3048,18 @@ def strip(self, to_strip=None):
@Appender(_shared_docs["str_strip"] % dict(side="left side", method="lstrip"))
@forbid_nonstring_types(["bytes"])
def lstrip(self, to_strip=None):
"""
Remove leading characters.
"""
result = str_strip(self._parent, to_strip, side="left")
return self._wrap_result(result)

@Appender(_shared_docs["str_strip"] % dict(side="right side", method="rstrip"))
@forbid_nonstring_types(["bytes"])
def rstrip(self, to_strip=None):
"""
Remove trailing characters.
"""
result = str_strip(self._parent, to_strip, side="right")
return self._wrap_result(result)

Expand Down