(sc
.parallelize([("a",1), ("b",5), ("c",1), ("d",3)])
.max(key=lambda x:x[1]))
returns ('b', 5), not just 5. The first parameter maxis the key used for comparison (explained here), but max still returns an integer value, here is the complete set.
source
share