| [ Web Proxy ] |
| Viewing: https://spark.apache.org/docs/latest/api/python/reference/api/pyspark.RDD.mapValues.html | [Back] [Original] |
Site Navigation
Site Navigation
Section Navigation
Pass each value in the key-value pair RDD through a map function without changing the keys; this also retains the original RDDs partitioning.
New in version 0.7.0.
a function to turn a V into a U
See also
Examples
>>> rdd = sc.parallelize([("a", ["apple", "banana", "lemon"]), ("b", ["grapes"])])
>>> def f(x): return len(x)
...
>>> rdd.mapValues(f).collect()
[('a', 3), ('b', 1)]
Copyright @ 2026 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
Created using Sphinx 4.5.0.
Built with the PyData Sphinx Theme 0.13.3.
| Web Proxy Viewer | New URL | Original Page |