diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/pyspark/rdd.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python/pyspark/rdd.py b/python/pyspark/rdd.py index ae09dbff02..ca2dc119a4 100644 --- a/python/pyspark/rdd.py +++ b/python/pyspark/rdd.py @@ -180,6 +180,10 @@ class RDD(object): def map(self, f, preservesPartitioning=False): """ Return a new RDD by applying a function to each element of this RDD. + + >>> rdd = sc.parallelize(["b", "a", "c"]) + >>> sorted(rdd.map(lambda x: (x, 1)).collect()) + [('a', 1), ('b', 1), ('c', 1)] """ def func(split, iterator): return imap(f, iterator) return PipelinedRDD(self, func, preservesPartitioning) |