pyspark.sql.functions.
rpad
Right-pad the string column to width len with pad.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
target column to work on.
length of the final string.
chars to append.
right padded result.
Examples
>>> df = spark.createDataFrame([('abcd',)], ['s',]) >>> df.select(rpad(df.s, 6, '#').alias('s')).collect() [Row(s='abcd##')]