This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import reduce | |
from itertools import groupby | |
def reduceByKey(func, iterable): | |
"""Reduce by key. | |
Equivalent to the Spark counterpart | |
Inspired by http://stackoverflow.com/q/33648581/554319 |