From f52f53ff3f42d587ef9af92c8bcbb54f6f2c2eeb Mon Sep 17 00:00:00 2001 From: Lesley Date: Thu, 7 May 2020 17:37:16 -0400 Subject: [PATCH 1/4] DOC:GH34026 --- pandas/core/strings.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 72d778524a364..85048e734639d 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -2977,8 +2977,7 @@ def encode(self, encoding, errors="strict"): _shared_docs[ "str_strip" ] = r""" - Remove leading and trailing characters. - + 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`. @@ -3050,12 +3049,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) From 8a6d8aa03626b562e0cceabf6d1a36d88e8e743c Mon Sep 17 00:00:00 2001 From: Lesley Date: Fri, 8 May 2020 13:16:24 -0400 Subject: [PATCH 2/4] DOC:Fixing desc. for Series.str.rstrip() and Series.str.lstrip() (pandas-dev#34026) --- pandas/core/strings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 85048e734639d..569e98c4776c7 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -2977,7 +2977,6 @@ def encode(self, encoding, errors="strict"): _shared_docs[ "str_strip" ] = r""" - 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`. From b8df42c92bb32c87002b70d95f184c8fb516529c Mon Sep 17 00:00:00 2001 From: Lesley Date: Thu, 14 May 2020 16:11:25 -0400 Subject: [PATCH 3/4] DOC:Removed text strings from lstrip and rstrip. Added a new %position item to each dict. (pandas-dev34026) --- pandas/core/strings.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 569e98c4776c7..e3877158fc7e9 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -2977,6 +2977,8 @@ def encode(self, encoding, errors="strict"): _shared_docs[ "str_strip" ] = r""" + Remove %(position)s characters. + 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`. @@ -3038,28 +3040,29 @@ def encode(self, encoding, errors="strict"): """ @Appender( - _shared_docs["str_strip"] % dict(side="left and right sides", method="strip") + _shared_docs["str_strip"] + % dict(side="left and right sides", method="strip", position=None) ) @forbid_nonstring_types(["bytes"]) def strip(self, to_strip=None): result = str_strip(self._parent, to_strip, side="both") return self._wrap_result(result) - @Appender(_shared_docs["str_strip"] % dict(side="left side", method="lstrip")) + @Appender( + _shared_docs["str_strip"] + % dict(side="left side", method="lstrip", position="leading") + ) @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")) + @Appender( + _shared_docs["str_strip"] + % dict(side="right side", method="rstrip", position="trailing") + ) @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) From 79b08bd440dee49c74f7e4e799c8d14ddc64fe71 Mon Sep 17 00:00:00 2001 From: Lesley Date: Fri, 15 May 2020 14:26:34 -0400 Subject: [PATCH 4/4] DOC:Fixed strip so %position now reads leading and trailing. Built documentation locally to confirm changes (pandas-dev34026) --- pandas/core/strings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index e3877158fc7e9..80abf0483c9a5 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -3041,7 +3041,9 @@ def encode(self, encoding, errors="strict"): @Appender( _shared_docs["str_strip"] - % dict(side="left and right sides", method="strip", position=None) + % dict( + side="left and right sides", method="strip", position="leading and trailing" + ) ) @forbid_nonstring_types(["bytes"]) def strip(self, to_strip=None):