Если вы работаете с RDD, вы можете использовать ReduByKey для этого случая
>>> rdd.collect()
[("('best', 'it')", 3), ("('best', 'of')", 4), ("('best', 'the')", 3), ("('best', 'was')", 3), ("('it', 'of')", 11), ("('it', 'the')", 11)]
>>> rddMap = rdd.map(lambda x: x[0][1:-1].split(',')).flatMap(lambda x: [(i.replace("'","").strip(),1) for i in x])
>>> rddMap.collect()
[('best', 1), ('it', 1), ('best', 1), ('of', 1), ('best', 1), ('the', 1), ('best', 1), ('was', 1), ('it', 1), ('of', 1), ('it', 1), ('the', 1)]
>>> rddReduce = rddMap.reduceByKey(lambda x,y: x+y).map(lambda x: x[0]+','+str(x[1]))
>>> for i in rddReduce.collect(): print(i)
...
best,4
it,3
of,2
the,2
was,1