pyspark.sql.functions.array_max

pyspark.sql.functions.array_max(col)[source]

Collection function: returns the maximum value of the array.

Parameters

col – name of column or expression

>>> df = spark.createDataFrame([([2, 1, 3],), ([None, 10, -1],)], ['data'])
>>> df.select(array_max(df.data).alias('max')).collect()
[Row(max=3), Row(max=10)]

New in version 2.4.