reduce by key to list in spark code example Example: pyspark reduce a list RDD.takeOrdered(5, key = lambda x: x[0])