Repeat elements of a Series.
Returns a new Series where each element of the current Series is repeated consecutively a given number of times.
The number of repetitions for each element. This should be a non-negative integer. Repeating 0 times will return an empty Series.
Unused. Parameter needed for compatibility with DataFrame.
Newly created Series with repeated elements.
See also
Index.repeatEquivalent function for Index.
numpy.repeatSimilar method for numpy.ndarray.
Examples
>>> s = pd.Series(['a', 'b', 'c'])
>>> s
0 a
1 b
2 c
dtype: object
>>> s.repeat(2)
0 a
0 a
1 b
1 b
2 c
2 c
dtype: object
>>> s.repeat([1, 2, 3])
0 a
1 b
1 b
2 c
2 c
2 c
dtype: object
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Series.repeat.html