From 059c31d34772ff75b4b6812505ae17a80e543a91 Mon Sep 17 00:00:00 2001 From: Alex Wojno Date: Sat, 10 Aug 2024 16:07:46 -0400 Subject: [PATCH 1/2] Doctrings for pandas.Series.str functions pandas.Series.str.capitalize pandas.Series.str.casefold pandas.Series.str.center pandas.Series.str.decode pandas.Series.str.encode --- ci/code_checks.sh | 5 ----- pandas/core/strings/accessor.py | 31 ++++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 540bd59cd5924..6a330b901746d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -158,11 +158,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.sparse.sp_values SA01" \ -i "pandas.Series.sparse.to_coo PR07,RT03,SA01" \ -i "pandas.Series.std PR01,RT03,SA01" \ - -i "pandas.Series.str.capitalize RT03" \ - -i "pandas.Series.str.casefold RT03" \ - -i "pandas.Series.str.center RT03,SA01" \ - -i "pandas.Series.str.decode PR07,RT03,SA01" \ - -i "pandas.Series.str.encode PR07,RT03,SA01" \ -i "pandas.Series.str.ljust RT03,SA01" \ -i "pandas.Series.str.lower RT03" \ -i "pandas.Series.str.lstrip RT03" \ diff --git a/pandas/core/strings/accessor.py b/pandas/core/strings/accessor.py index 25fdafa9b8354..8a2e1cd3f0271 100644 --- a/pandas/core/strings/accessor.py +++ b/pandas/core/strings/accessor.py @@ -1749,6 +1749,18 @@ def pad( Returns ------- Series/Index of objects. + A Series or Index where the strings are modified by :meth:`str.%(method)s`. + + See Also + -------- + Series.str.rjust : Fills the left side of strings with an arbitrary + character. + Series.str.ljust : Fills the right side of strings with an arbitrary + character. + Series.str.center : Fills both sides of strings with an arbitrary + character. + Series.str.zfill : Pad strings in the Series/Index by prepending '0' + character. Examples -------- @@ -2024,11 +2036,19 @@ def decode(self, encoding, errors: str = "strict"): Parameters ---------- encoding : str + Specifies the encoding to be used. errors : str, optional + Specifies the error handling scheme. + Possible values are those supported by :meth:`bytes.decode`. Returns ------- Series or Index + A Series or Index with decoded strings. + + See Also + -------- + Series.str.encode : Encodes strings into bytes in a Series/Index. Examples -------- @@ -2063,11 +2083,19 @@ def encode(self, encoding, errors: str = "strict"): Parameters ---------- encoding : str + Specifies the encoding to be used. errors : str, optional + Specifies the error handling scheme. + Possible values are those supported by :meth:`str.encode`. Returns ------- Series/Index of objects + A Series or Index with strings encoded into bytes. + + See Also + -------- + Series.str.decode : Decodes bytes into strings in a Series/Index. Examples -------- @@ -3209,7 +3237,8 @@ def len(self): Returns ------- - Series or Index of object + Series or Index of objects + A Series or Index where the strings are modified by :meth:`str.%(method)s`. See Also -------- From ca8bb8e5251fa89f5b90f44e2d8a0e01d6906d6e Mon Sep 17 00:00:00 2001 From: Alex Wojno Date: Sun, 11 Aug 2024 08:55:32 -0400 Subject: [PATCH 2/2] Fixed other docstrings along the way --- ci/code_checks.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 6a330b901746d..cd1a2d3763902 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -158,21 +158,15 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.sparse.sp_values SA01" \ -i "pandas.Series.sparse.to_coo PR07,RT03,SA01" \ -i "pandas.Series.std PR01,RT03,SA01" \ - -i "pandas.Series.str.ljust RT03,SA01" \ - -i "pandas.Series.str.lower RT03" \ -i "pandas.Series.str.lstrip RT03" \ -i "pandas.Series.str.match RT03" \ -i "pandas.Series.str.normalize RT03,SA01" \ -i "pandas.Series.str.partition RT03" \ -i "pandas.Series.str.repeat SA01" \ -i "pandas.Series.str.replace SA01" \ - -i "pandas.Series.str.rjust RT03,SA01" \ -i "pandas.Series.str.rpartition RT03" \ -i "pandas.Series.str.rstrip RT03" \ -i "pandas.Series.str.strip RT03" \ - -i "pandas.Series.str.swapcase RT03" \ - -i "pandas.Series.str.title RT03" \ - -i "pandas.Series.str.upper RT03" \ -i "pandas.Series.str.wrap RT03,SA01" \ -i "pandas.Series.str.zfill RT03" \ -i "pandas.Series.struct.dtypes SA01" \