pyspark.sql.functions.greatest¶
-
pyspark.sql.functions.
greatest
(*cols)[source]¶ Returns the greatest value of the list of column names, skipping null values. This function takes at least 2 parameters. It will return null iff all parameters are null.
New in version 1.5.0.
Examples
>>> df = spark.createDataFrame([(1, 4, 3)], ['a', 'b', 'c']) >>> df.select(greatest(df.a, df.b, df.c).alias("greatest")).collect() [Row(greatest=4)]