# pyspark.pandas.Series.repeat¶

Series.repeat(repeats: Union[int, Series]) → pyspark.pandas.series.Series

Repeat elements of a Series.

Returns a new Series where each element of the current Series is repeated consecutively a given number of times.

Parameters
repeatsint or Series

The number of repetitions for each element. This should be a non-negative integer. Repeating 0 times will return an empty Series.

Returns
Series

Newly created Series with repeated elements.

Index.repeat

Equivalent function for Index.

Examples

>>> s = ps.Series(['a', 'b', 'c'])
>>> s
0    a
1    b
2    c
dtype: object
>>> s.repeat(2)
0    a
1    b
2    c
0    a
1    b
2    c
dtype: object
>>> ps.Series([1, 2, 3]).repeat(0)
Series([], dtype: int64)