python/pyspark/rdd.py
def foldByKey(self, zeroValue, func, numPartitions=None):
        """
        Merge the values for each key using an associative function "func" and a neutral "zeroValue"
        which may be added to the result an arbitrary number of times, and must not change 
        the result (e.g., 0 for addition, or 1 for multiplication.).                

        >>> rdd = sc.parallelize([("a", 1), ("b", 1), ("a", 1)])
        >>> from operator import add
        >>> rdd.foldByKey(0, add).collect()
        [('a', 2), ('b', 1)]
        """
        return self.combineByKey(lambda v: func(zeroValue, v), func, func, numPartitions)

        Merge the values for each key using an associative function "func" and a neutral "zeroValue"
        which may be added to the result an arbitrary number of times, and must not change 
        the result (e.g., 0 for addition, or 1 for multiplication.).                

        >>> rdd = sc.parallelize([("a", 1), ("b", 1), ("a", 1)])
        >>> from operator import add
        >>> rdd.foldByKey(0, add).collect()
        [('a', 2), ('b', 1)]
        
Merge the values for each key using an associative function "func" and a neutral "zeroValue"
which may be added to the result an arbitrary number of times, and must not change
the result .


Merge the values for each key using an associative function " func " and a neutral " zeroValue " which may be added to the result an arbitrary number of times and must not change the result .
def foldByKey(self, zeroValue, func, numPartitions=None):
        return self.combineByKey(lambda v: func(zeroValue, v), func, func, numPartitions)
def foldByKey ( self , zeroValue , func , numPartitions = None ) : return self . combineByKey ( lambda v : func ( zeroValue , v ) , func , func , numPartitions )
Merge the values for each key using an associative function "func" and a neutral "zeroValue"
which may be added to the result an arbitrary number of times, and must not change
the result (e.g., 0 for addition, or 1 for multiplication.
Merge the values for each key using an associative function " func " and a neutral " zeroValue " which may be added to the result an arbitrary number of times and must not change the result ( e . g . 0 for addition or 1 for multiplication .
"""
        Merge the values for each key using an associative function "func" and a neutral "zeroValue"
        which may be added to the result an arbitrary number of times, and must not change 
        the result (e.g., 0 for addition, or 1 for multiplication.).                

        >>> rdd = sc.parallelize([("a", 1), ("b", 1), ("a", 1)])
        >>> from operator import add
        >>> rdd.foldByKey(0, add).collect()
        [('a', 2), ('b', 1)]
        """
self
zeroValue
func
numPartitions