Skip to content

Commit d21886c

Browse files
Refactor docstrings in StringMethods for improved readability and clarity
1 parent dddebff commit d21886c

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

pandas/_libs/tslibs/offsets.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5108,8 +5108,8 @@ def _warn_about_deprecated_aliases(name: str, is_period: bool) -> str:
51085108
warnings.warn(
51095109
f"\'{name}\' is deprecated and will be removed "
51105110
f"in a future version, please use "
5111-
f"\'{c_PERIOD_AND_OFFSET_DEPR_FREQSTR.get(name)}\'"
5112-
f" instead.",
5111+
f"\'{c_PERIOD_AND_OFFSET_DEPR_FREQSTR.get(name)}\' "
5112+
f"instead.",
51135113
FutureWarning,
51145114
stacklevel=find_stack_level(),
51155115
)
@@ -5122,8 +5122,8 @@ def _warn_about_deprecated_aliases(name: str, is_period: bool) -> str:
51225122
warnings.warn(
51235123
f"\'{name}\' is deprecated and will be removed "
51245124
f"in a future version, please use "
5125-
f"\'{_name}\'"
5126-
f" instead.",
5125+
f"\'{_name}\' "
5126+
f"instead.",
51275127
FutureWarning,
51285128
stacklevel=find_stack_level(),
51295129
)

pandas/core/strings/accessor.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,10 @@ def fullmatch(self, pat, case: bool = True, flags: int = 0, na=lib.no_default):
14311431
Determine if each string entirely matches a regular expression.
14321432
14331433
Checks if each string in the Series or Index fully matches the
1434-
specified regular expression pattern. This function is useful when the
1435-
requirement is for an entire string to conform to a pattern, such as
1434+
specified regular expression pattern.
1435+
This function is useful when the
1436+
requirement is for an entire string to conform
1437+
to a pattern, such as
14361438
validating formats like phone numbers or email addresses.
14371439
14381440
Parameters
@@ -1458,21 +1460,23 @@ def fullmatch(self, pat, case: bool = True, flags: int = 0, na=lib.no_default):
14581460
14591461
See Also
14601462
--------
1461-
match : Similar, but also returns `True` when only a *prefix* of the string
1463+
match : Similar, but also returns `True`
1464+
when only a *prefix* of the string
14621465
matches the regular expression.
14631466
extract : Extract matched groups.
14641467
14651468
Notes
14661469
-----
14671470
This method enforces consistent behavior between Python's string dtype
14681471
and PyArrow-backed string arrays when using regular expressions
1469-
containing alternation (|). For regex patterns with alternation operators,
1470-
the method ensures proper grouping by wrapping the pattern in parentheses
1472+
containing alternation (|). For regex
1473+
patterns with alternation operators,
1474+
the method ensures proper grouping by
1475+
wrapping the pattern in parentheses
14711476
when using PyArrow-backed string arrays.
14721477
14731478
Examples
14741479
--------
1475-
>>> import pandas as pd
14761480
>>> s = pd.Series(["foo", "bar", "foobar", ""])
14771481
>>> s.str.fullmatch("foo")
14781482
0 True
@@ -2675,7 +2679,7 @@ def translate(self, table):
26752679

26762680
@forbid_nonstring_types(["bytes"])
26772681
def count(self, pat, flags: int = 0):
2678-
r"""
2682+
"""
26792683
Count occurrences of pattern in each string of the Series/Index.
26802684
26812685
This function is used to count the number of times a particular regex

0 commit comments

Comments
 (0)