Answers for "Merge the values for each key using an associative and commutative reduce function."

0

Merge the values for each key using an associative and commutative reduce function.

from operator import add
rdd = sc.parallelize([("a", 1), ("b", 1), ("a", 1)])
sorted(rdd.reduceByKey(add).collect())
# [('a', 2), ('b', 1)]
Posted by: Guest on March-11-2020

Code answers related to "Merge the values for each key using an associative and commutative reduce function."

Python Answers by Framework

Browse Popular Code Answers by Language