pyspark.sql.functions.repeat

pyspark.sql.functions.repeat(col, n)[source]

Repeats a string column n times, and returns it as a new string column.

New in version 1.5.0.

Examples

>>> df = spark.createDataFrame([('ab',)], ['s',])
>>> df.select(repeat(df.s, 3).alias('s')).collect()
[Row(s='ababab')]