pyspark.RDD.sampleVariance

RDD.sampleVariance() → float[source]

Compute the sample variance of this RDD’s elements (which corrects for bias in estimating the variance by dividing by N-1 instead of N).

New in version 0.9.1.

Returns
float

the sample variance of all elements

Examples

>>> sc.parallelize([1, 2, 3]).sampleVariance()
1.0