pyspark.pandas.Series.str.repeat

str.repeat(repeats: int) → ps.Series

Duplicate each string in the Series.

Parameters
repeatsint

Repeat the string given number of times (int). Sequence of int is not supported.

Returns
Series of object

Series or Index of repeated string objects specified by input parameter repeats.

Examples

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

Single int repeats string in Series

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