Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Computes the floor of the given value. Supports Spark Connect.
For the corresponding Databricks SQL function, see floor function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.floor(col=<col>, scale=<scale>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
The target column or column name to compute the floor on. |
scale |
pyspark.sql.Column or int, optional |
An optional parameter to control the rounding behavior. |
Returns
pyspark.sql.Column: nearest integer that is less than or equal to given value.
Examples
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.floor(dbf.lit(2.5))).show()
+----------+
|FLOOR(2.5)|
+----------+
| 2|
+----------+
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.floor(dbf.lit(2.1267), dbf.lit(2))).show()
+----------------+
|floor(2.1267, 2)|
+----------------+
| 2.12|
+----------------+