pyspark.sql.functions.printf¶
-
pyspark.sql.functions.
printf
(format: ColumnOrName, *cols: ColumnOrName) → pyspark.sql.column.Column[source]¶ Formats the arguments in printf-style and returns the result as a string column.
New in version 3.5.0.
- Parameters
Examples
>>> import pyspark.sql.functions as sf >>> spark.createDataFrame( ... [("aa%d%s", 123, "cc",)], ["a", "b", "c"] ... ).select(sf.printf("a", "b", "c")).show() +---------------+ |printf(a, b, c)| +---------------+ | aa123cc| +---------------+