pyspark.sql.functions.ceil#
- pyspark.sql.functions.ceil(col, scale=None)[source]#
Computes the ceiling of the given value.
Added in version 1.4.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters:
- Returns:
ColumnA column for the computed results. Returns a column that evaluates to a long or decimal.
See also
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| +-------------+