Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- words = sc.textFile("D:/workspace/spark/input.txt")
- .flatMap(lambda line: line.split(" "))
- wordCounts = words.map(lambda word: (word, 1))
- .reduceByKey(lambda a,b: a + b)
- wordCounts.saveAsTextFile("D:/workspace/spark/output/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement