On this page
statistics.variance
Prev: statistics.stdev | Up: statistics
Rel: statistics.correlation, statistics.covariance, statistics.fmean, statistics.geometric_mean
Ref: docs.python.org — statistics.variance
Tags: #public #python3 #stdlib #statistics
Import
import statistics
from statistics import variance
Signature & Overview
statistics.variance(data, xbar=None)
Return the sample variance of data.
Usage
import statistics
assert statistics.variance([1, 2, 3]) == 1
Gotchas
- Sample variance ($N - 1$): Raises
StatisticsErroron fewer than 2 values.
REPL Inspect
from statistics import variance
help(variance)
Linked from
Related notes
- tuts/python3/stdlib_module/statistics/stdev Linked here; links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/statistics/correlation Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/covariance Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/fmean Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/geometric_mean Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/harmonic_mean shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/kde shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/kde_random shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/linear_regression shared tags: #statistics, #stdlib