Compute the variance of this RDD’s elements code example
Example 1: Compute the variance of this RDD’s elements
# variance()
m = sc.parallelize([1, 2, 3]).variance()
# 0.666...
Example 2: Compute the mean of this RDD’s elements.
sc.parallelize([1, 2, 3]).mean()
# 2.0