Created
September 23, 2012 12:05
-
-
Save bwhite/3770140 to your computer and use it in GitHub Desktop.
Hadoopy Workcount
This file contains 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
import hadoopy | |
def mapper(key, value): | |
# Split line into words | |
for word in value.split(): | |
yield word, 1 | |
def reducer(key, values): | |
yield key, sum(values) | |
if __name__ == "__main__": | |
hadoopy.run(mapper, reducer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment