Skip to content

DOC: Updating str_repeat docstring #22566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,12 +680,35 @@ def str_repeat(arr, repeats):

Parameters
----------
repeats : int or array
Same value for all (int) or different value per (array)
repeats : int or sequence of int
Same value for all (int) or different value per (sequence)

Returns
-------
repeated : Series/Index of objects
Series or Index of object
Series or Index of repeated string object specified by input parameter repeats

Examples
--------
>>> s = pd.Series(['a', 'b', 'c'])
>>> s
0 a
1 b
2 c

Single int repeats string in Series

>>> s.str.repeat(repeats=2)
0 aa
1 bb
2 cc

Sequence of int repeats corresponding string in Series

>>> s.str.repeat(repeats=[1, 2, 3])
0 a
1 bb
2 ccc
"""
if is_scalar(repeats):

Expand Down