printf
Formats the arguments in printf-style and returns the result as a string column.
For the corresponding Databricks SQL function, see printf function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.printf(format=<format>, *cols=<*cols>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| string that can contain embedded format tags and used as result column's value |
|
| column names or |
Examples
Python
from pyspark.databricks.sql import functions as dbf
spark.createDataFrame(
[("aa%d%s", 123, "cc",)], ["a", "b", "c"]
).select(dbf.printf("a", "b", "c")).show()