diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 72d778524a364..80abf0483c9a5 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -2977,7 +2977,7 @@ def encode(self, encoding, errors="strict"): _shared_docs[ "str_strip" ] = r""" - Remove leading and trailing characters. + Remove %(position)s characters. Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from %(side)s. @@ -3040,20 +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="leading and trailing" + ) ) @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): 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): result = str_strip(self._parent, to_strip, side="right")