Share via


rint

Returns the double value that is closest in value to the argument and is equal to a mathematical integer. Supports Spark Connect.

For the corresponding Databricks SQL function, see rint function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.rint(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or column name target column to compute on.

Returns

pyspark.sql.Column: the column for computed results.

Examples

from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.rint(dbf.lit(10.6))).show()
spark.range(1).select(dbf.rint(dbf.lit(10.3))).show()
+----------+
|rint(10.6)|
+----------+
|      11.0|
+----------+

+----------+
|rint(10.3)|
+----------+
|      10.0|
+----------+