pyspark.RDD.max

RDD.max(key: Optional[Callable[[T], S]] = None) → T[source]

Find the maximum item in this RDD.

New in version 1.0.0.

Parameters
keyfunction, optional

A function used to generate key for comparing

Returns
T

the maximum item

See also

RDD.min()

Examples

>>> rdd = sc.parallelize([1.0, 5.0, 43.0, 10.0])
>>> rdd.max()
43.0
>>> rdd.max(key=str)
5.0