pyspark.RDD.sum

RDD.sum() → NumberOrArray[source]

Add up the elements in this RDD.

New in version 0.7.0.

Returns
float, int, or complex

the sum of all elements

Examples

>>> sc.parallelize([1.0, 2.0, 3.0]).sum()
6.0