Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Formats the arguments in printf-style and returns the result as a string column.
For the corresponding Databricks SQL function, see printf function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.printf(format=<format>, *cols=<*cols>)
Parameters
| Parameter | Type | Description |
|---|---|---|
format |
pyspark.sql.Column or str |
string that can contain embedded format tags and used as result column's value |
cols |
pyspark.sql.Column or str |
column names or pyspark.sql.Column to be used in formatting |
Examples
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()