Skip to content

Commit

Permalink
DOC: Enforce Numpy Docstring Validation for pandas.Series.str methods (
Browse files Browse the repository at this point in the history
…#59474)

* 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

* Fixed other docstrings along the way
  • Loading branch information
awojno-bloomberg authored Aug 12, 2024
1 parent a3f2d48 commit 32d0ae9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
11 changes: 0 additions & 11 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +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.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" \
-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" \
Expand Down
31 changes: 30 additions & 1 deletion pandas/core/strings/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down Expand Up @@ -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
--------
Expand Down Expand Up @@ -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
--------
Expand Down Expand Up @@ -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
--------
Expand Down

0 comments on commit 32d0ae9

Please sign in to comment.