pyspark.sql.functions.ceil#
- pyspark.sql.functions.ceil(col, scale=None)[source]#
Computes the ceiling of the given value.
New in version 1.4.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- Returns
Column
A column for the computed results.
Examples
Example 1: Compute the ceiling of a column value
>>> from pyspark.sql import functions as sf >>> spark.range(1).select(sf.ceil(sf.lit(-0.1))).show() +----------+ |CEIL(-0.1)| +----------+ | 0| +----------+
Example 2: Compute the ceiling of a column value with a specified scale
>>> from pyspark.sql import functions as sf >>> spark.range(1).select(sf.ceil(sf.lit(-0.1), 1)).show() +-------------+ |ceil(-0.1, 1)| +-------------+ | -0.1| +-------------+