Σημείωση
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να συνδεθείτε ή να αλλάξετε καταλόγους.
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να αλλάξετε καταλόγους.
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()