Skip to content

Commit 5600fc1

Browse files
authored
DOC: updated strings.py for SS06 errors (#34745)
1 parent f30aeef commit 5600fc1

File tree

1 file changed

+36
-20
lines changed

1 file changed

+36
-20
lines changed

pandas/core/strings.py

+36-20
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,9 @@ def str_endswith(arr, pat, na=np.nan):
570570

571571
def str_replace(arr, pat, repl, n=-1, case=None, flags=0, regex=True):
572572
r"""
573-
Replace occurrences of pattern/regex in the Series/Index with
574-
some other string. Equivalent to :meth:`str.replace` or
575-
:func:`re.sub`, depending on the regex value.
573+
Replace each occurrence of pattern/regex in the Series/Index.
574+
575+
Equivalent to :meth:`str.replace` or :func:`re.sub`, depending on the regex value.
576576
577577
Parameters
578578
----------
@@ -1063,6 +1063,8 @@ def str_extract(arr, pat, flags=0, expand=True):
10631063

10641064
def str_extractall(arr, pat, flags=0):
10651065
r"""
1066+
Extract capture groups in the regex `pat` as columns in DataFrame.
1067+
10661068
For each subject string in the Series, extract groups from all
10671069
matches of regular expression pat. When each subject string in the
10681070
Series has exactly one match, extractall(pat).xs(0, level='match')
@@ -1174,7 +1176,9 @@ def str_extractall(arr, pat, flags=0):
11741176

11751177
def str_get_dummies(arr, sep="|"):
11761178
"""
1177-
Split each string in the Series by sep and return a DataFrame
1179+
Return DataFrame of dummy/indicator variables for Series.
1180+
1181+
Each string in Series is split by sep and returned as a DataFrame
11781182
of dummy/indicator variables.
11791183
11801184
Parameters
@@ -1743,8 +1747,7 @@ def str_strip(arr, to_strip=None, side="both"):
17431747

17441748
def str_wrap(arr, width, **kwargs):
17451749
r"""
1746-
Wrap long strings in the Series/Index to be formatted in
1747-
paragraphs with length less than a given width.
1750+
Wrap strings in Series/Index at specified line width.
17481751
17491752
This method has the same keyword parameters and defaults as
17501753
:class:`textwrap.TextWrapper`.
@@ -1807,6 +1810,7 @@ def str_wrap(arr, width, **kwargs):
18071810
def str_translate(arr, table):
18081811
"""
18091812
Map all characters in the string through the given mapping table.
1813+
18101814
Equivalent to standard :meth:`str.translate`.
18111815
18121816
Parameters
@@ -1889,6 +1893,7 @@ def f(x):
18891893
def str_decode(arr, encoding, errors="strict"):
18901894
"""
18911895
Decode character string in the Series/Index using indicated encoding.
1896+
18921897
Equivalent to :meth:`str.decode` in python2 and :meth:`bytes.decode` in
18931898
python3.
18941899
@@ -1913,6 +1918,7 @@ def str_decode(arr, encoding, errors="strict"):
19131918
def str_encode(arr, encoding, errors="strict"):
19141919
"""
19151920
Encode character string in the Series/Index using indicated encoding.
1921+
19161922
Equivalent to :meth:`str.encode`.
19171923
19181924
Parameters
@@ -2068,9 +2074,11 @@ def do_copy(target):
20682074

20692075
class StringMethods(NoNewAttributesMixin):
20702076
"""
2071-
Vectorized string functions for Series and Index. NAs stay NA unless
2072-
handled otherwise by a particular method. Patterned after Python's string
2073-
methods, with some inspiration from R's stringr package.
2077+
Vectorized string functions for Series and Index.
2078+
2079+
NAs stay NA unless handled otherwise by a particular method.
2080+
Patterned after Python's string methods, with some inspiration from
2081+
R's stringr package.
20742082
20752083
Examples
20762084
--------
@@ -2853,8 +2861,9 @@ def pad(self, width, side="left", fillchar=" "):
28532861
_shared_docs[
28542862
"str_pad"
28552863
] = """
2856-
Filling %(side)s side of strings in the Series/Index with an
2857-
additional character. Equivalent to :meth:`str.%(method)s`.
2864+
Pad %(side)s side of strings in the Series/Index.
2865+
2866+
Equivalent to :meth:`str.%(method)s`.
28582867
28592868
Parameters
28602869
----------
@@ -3117,9 +3126,11 @@ def extractall(self, pat, flags=0):
31173126
_shared_docs[
31183127
"find"
31193128
] = """
3120-
Return %(side)s indexes in each strings in the Series/Index
3121-
where the substring is fully contained between [start:end].
3122-
Return -1 on failure. Equivalent to standard :meth:`str.%(method)s`.
3129+
Return %(side)s indexes in each strings in the Series/Index.
3130+
3131+
Each of returned indexes corresponds to the position where the
3132+
substring is fully contained between [start:end]. Return -1 on
3133+
failure. Equivalent to standard :meth:`str.%(method)s`.
31233134
31243135
Parameters
31253136
----------
@@ -3169,6 +3180,7 @@ def rfind(self, sub, start=0, end=None):
31693180
def normalize(self, form):
31703181
"""
31713182
Return the Unicode normal form for the strings in the Series/Index.
3183+
31723184
For more information on the forms, see the
31733185
:func:`unicodedata.normalize`.
31743186
@@ -3190,10 +3202,13 @@ def normalize(self, form):
31903202
_shared_docs[
31913203
"index"
31923204
] = """
3193-
Return %(side)s indexes in each strings where the substring is
3194-
fully contained between [start:end]. This is the same as
3195-
``str.%(similar)s`` except instead of returning -1, it raises a ValueError
3196-
when the substring is not found. Equivalent to standard ``str.%(method)s``.
3205+
Return %(side)s indexes in each string in Series/Index.
3206+
3207+
Each of the returned indexes corresponds to the position where the
3208+
substring is fully contained between [start:end]. This is the same
3209+
as ``str.%(similar)s`` except instead of returning -1, it raises a
3210+
ValueError when the substring is not found. Equivalent to standard
3211+
``str.%(method)s``.
31973212
31983213
Parameters
31993214
----------
@@ -3244,8 +3259,9 @@ def rindex(self, sub, start=0, end=None):
32443259
_shared_docs[
32453260
"len"
32463261
] = """
3247-
Compute the length of each element in the Series/Index. The element may be
3248-
a sequence (such as a string, tuple or list) or a collection
3262+
Compute the length of each element in the Series/Index.
3263+
3264+
The element may be a sequence (such as a string, tuple or list) or a collection
32493265
(such as a dictionary).
32503266
32513267
Returns

0 commit comments

Comments
 (0)