pyspark.sql.functions.repeat

pyspark.sql.functions.repeat(col: ColumnOrName, n: int) → pyspark.sql.column.Column

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

Examples

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