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 str target column to compute on.
- col
- Returns
Column
the column for computed results.
Examples
>>> df = spark.range(1) >>> df.select(rint(lit(10.6))).show() +----------+ |rint(10.6)| +----------+ | 11.0| +----------+
>>> df.select(rint(lit(10.3))).show() +----------+ |rint(10.3)| +----------+ | 10.0| +----------+