rdd = sc.parallelize([('2013-10-09', 10), ('2013-10-09', 10), (
    '2013-10-09', 13), ('2013-10-10', 40), ('2013-10-10', 45), (
    '2013-10-10', 50)])
rdd.groupByKey().mapValues(lambda x: sum(x) / len(x)).collect()
Calculating the averages for each KEY in a Pairwise (K,V) RDD in Spark with Python