pyspark.sql.functions.least#

pyspark.sql.functions.least(*cols)[source]#

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.

New in version 1.5.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
colsColumn or str

column names or columns to be compared

Returns
Column

least value.

Examples

>>> df = spark.createDataFrame([(1, 4, 3)], ['a', 'b', 'c'])
>>> df.select(least(df.a, df.b, df.c).alias("least")).collect()
[Row(least=1)]