[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
spark:using-python [2022/12/14 12:59]
straka [Usage Examples]
spark:using-python [2022/12/14 13:00]
straka [Usage Examples]
Line 19: Line 19:
    .flatMap(lambda line: line.split())    .flatMap(lambda line: line.split())
    .map(lambda word: (word, 1))    .map(lambda word: (word, 1))
-   .reduceByKey(lambda c1,c2: c1+c2)+   .reduceByKey(lambda c1, c2: c1+c2)
    .sortBy(lambda word_count: word_count[1], ascending=False)    .sortBy(lambda word_count: word_count[1], ascending=False)
    .take(10))    .take(10))

[ Back to the navigation ] [ Back to the content ]