Statistics Functions

statistics.stdev()

Compute sample standard deviation using the sample variance with denominator n-1. At least two observations are required.

Formal Syntax & Structure

python syntaxpython
statistics.stdev(data, xbar=None)

Parameters & Attributes

NameTypeDescription
dataiterable of numbersObservations used by the statistic.
xbarnumber or NoneKnown sample mean, or None to calculate it.

Return Value

float or Decimal

Standard deviation; Decimal for Decimal data, float otherwise.

Working Example

Example Snippetpython
import statisticsprint(statistics.stdev([2, 4, 6]))
Python Reference