Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
Returns the greatest value of the list of column names, skipping null values. This function takes at least 2 parameters. It will return null if all parameters are null. Supports Spark Connect.
For the corresponding Databricks SQL function, see greatest function.
Syntax
from pyspark.sql import functions as dbf
dbf.greatest(cols=<cols>)
Parameters
| Parameter | Type | Description |
|---|---|---|
cols |
pyspark.sql.Column or column name |
columns to check for greatest value. |
Returns
pyspark.sql.Column: greatest value.
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(1, 4, 3)], ['a', 'b', 'c'])
df.select("*", dbf.greatest(df.a, "b", df.c)).show()
+---+---+---+-----------------+
| a| b| c|greatest(a, b, c)|
+---+---+---+-----------------+
| 1| 4| 3| 4|
+---+---+---+-----------------+