pyspark.RDD.sampleVariance

RDD.sampleVariance() → NumberOrArray[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).

Examples

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