Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Formats the arguments in printf-style and returns the result as a string column.
For the corresponding Databricks SQL function, see format_string function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.format_string(format=<format>, *cols=<*cols>)
Parameters
| Parameter | Type | Description |
|---|---|---|
format |
literal string |
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\s to be used in formatting |
Returns
pyspark.sql.Column: the column of formatted results.
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(5, "hello")], ["a", "b"])
df.select("*", dbf.format_string('%d %s', "a", df.b)).show()