Skip to content

Commit b667fdf

Browse files
authored
Add extended summary for fullmatch, match, pad, repeat, slice and slice_replace (pandas-dev#60520)
Add extended summary for fullmatch, match, pad, repeat, slice and slice_replace functions
1 parent f3b7985 commit b667fdf

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pandas/core/strings/accessor.py

+30
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,11 @@ def match(self, pat: str, case: bool = True, flags: int = 0, na=lib.no_default):
13741374
"""
13751375
Determine if each string starts with a match of a regular expression.
13761376
1377+
Determines whether each string in the Series or Index starts with a
1378+
match to a specified regular expression. This function is especially
1379+
useful for validating prefixes, such as ensuring that codes, tags, or
1380+
identifiers begin with a specific pattern.
1381+
13771382
Parameters
13781383
----------
13791384
pat : str
@@ -1419,6 +1424,11 @@ def fullmatch(self, pat, case: bool = True, flags: int = 0, na=lib.no_default):
14191424
"""
14201425
Determine if each string entirely matches a regular expression.
14211426
1427+
Checks if each string in the Series or Index fully matches the
1428+
specified regular expression pattern. This function is useful when the
1429+
requirement is for an entire string to conform to a pattern, such as
1430+
validating formats like phone numbers or email addresses.
1431+
14221432
Parameters
14231433
----------
14241434
pat : str
@@ -1647,6 +1657,10 @@ def repeat(self, repeats):
16471657
"""
16481658
Duplicate each string in the Series or Index.
16491659
1660+
Duplicates each string in the Series or Index, either by applying the
1661+
same repeat count to all elements or by using different repeat values
1662+
for each element.
1663+
16501664
Parameters
16511665
----------
16521666
repeats : int or sequence of int
@@ -1710,6 +1724,12 @@ def pad(
17101724
"""
17111725
Pad strings in the Series/Index up to width.
17121726
1727+
This function pads strings in a Series or Index to a specified width,
1728+
filling the extra space with a character of your choice. It provides
1729+
flexibility in positioning the padding, allowing it to be added to the
1730+
left, right, or both sides. This is useful for formatting strings to
1731+
align text or ensure consistent string lengths in data processing.
1732+
17131733
Parameters
17141734
----------
17151735
width : int
@@ -1920,6 +1940,11 @@ def slice(self, start=None, stop=None, step=None):
19201940
"""
19211941
Slice substrings from each element in the Series or Index.
19221942
1943+
Slicing substrings from strings in a Series or Index helps extract
1944+
specific portions of data, making it easier to analyze or manipulate
1945+
text. This is useful for tasks like parsing structured text fields or
1946+
isolating parts of strings with a consistent format.
1947+
19231948
Parameters
19241949
----------
19251950
start : int, optional
@@ -1996,6 +2021,11 @@ def slice_replace(self, start=None, stop=None, repl=None):
19962021
"""
19972022
Replace a positional slice of a string with another value.
19982023
2024+
This function allows replacing specific parts of a string in a Series
2025+
or Index by specifying start and stop positions. It is useful for
2026+
modifying substrings in a controlled way, such as updating sections of
2027+
text based on their positions or patterns.
2028+
19992029
Parameters
20002030
----------
20012031
start : int, optional

0 commit comments

Comments
 (0)