pyspark.sql.functions.format_string¶
-
pyspark.sql.functions.
format_string
(format, *cols)[source]¶ Formats the arguments in printf-style and returns the result as a string column.
New in version 1.5.0.
- Parameters
Examples
>>> df = spark.createDataFrame([(5, "hello")], ['a', 'b']) >>> df.select(format_string('%d %s', df.a, df.b).alias('v')).collect() [Row(v='5 hello')]