Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Returns the least 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 least function.
Syntax
from pyspark.sql import functions as dbf
dbf.least(cols=<cols>)
Parameters
| Parameter | Type | Description |
|---|---|---|
cols |
pyspark.sql.Column or column name |
column names or columns to be compared |
Returns
pyspark.sql.Column: least value.
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(1, 4, 3)], ['a', 'b', 'c'])
df.select("*", dbf.least(df.a, "b", df.c)).show()
+---+---+---+--------------+
| a| b| c|least(a, b, c)|
+---+---+---+--------------+
| 1| 4| 3| 1|
+---+---+---+--------------+