pyspark.sql.functions.repeat

pyspark.sql.functions.repeat(col: ColumnOrName, n: int) → pyspark.sql.column.Column[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')]