Can anyone convert this very simple scala code to python?
val words = Array("one", "two", "two", "three", "three", "three")
val wordPairsRDD = sc.parallelize(words).map(word => (word, 1))
val wordCountsWithGroup = wordPairsRDD
.groupByKey()
.map(t => (t._1, t._2.sum))
.collect()
import collections;words = ["one", "two", "two", "three", "three", "three"];collections.Counter(words)would work if{ "one" : 1, "two" : 2, "three" : 3}is what you want.