Answers for "Return an RDD of grouped items."

0

Return an RDD of grouped items.

rdd = sc.parallelize([1, 1, 2, 3, 5, 8])
result = rdd.groupBy(lambda x: x % 2).collect()
sorted([(x, sorted(y)) for (x,y) in result])
# [(0, [2, 8]), (1, [1, 1, 3, 5])]
Posted by: Guest on March-11-2020

Code answers related to "Return an RDD of grouped items."

Python Answers by Framework

Browse Popular Code Answers by Language