pyspark.sql.functions.rint#
- pyspark.sql.functions.rint(col)[source]#
Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
New in version 1.4.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or column name target column to compute on.
- col
- Returns
Column
the column for computed results.
Examples
>>> import pyspark.sql.functions as sf >>> spark.range(1).select(sf.rint(sf.lit(10.6))).show() +----------+ |rint(10.6)| +----------+ | 11.0| +----------+
>>> spark.range(1).select(sf.rint(sf.lit(10.3))).show() +----------+ |rint(10.3)| +----------+ | 10.0| +----------+