MCPcopy Index your code
hub / github.com/python/cpython / pstdev

Function pstdev

Lib/statistics.py:632–652  ·  view source on GitHub ↗

Return the square root of the population variance. See ``pvariance`` for arguments and other details. >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 0.986893273527251

(data, mu=None)

Source from the content-addressed store, hash-verified

630
631
632def pstdev(data, mu=None):
633 """Return the square root of the population variance.
634
635 See ``pvariance`` for arguments and other details.
636
637 >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
638 0.986893273527251
639
640 """
641 T, ss, c, n = _ss(data, mu)
642 if n < 1:
643 raise StatisticsError('pstdev requires at least one data point')
644 mss = ss / n
645 try:
646 mss_numerator = mss.numerator
647 mss_denominator = mss.denominator
648 except AttributeError:
649 raise ValueError('inf or nan encountered in data')
650 if issubclass(T, Decimal):
651 return _decimal_sqrt_of_frac(mss_numerator, mss_denominator)
652 return _float_sqrt_of_frac(mss_numerator, mss_denominator)
653
654
655## Statistics for relations between two inputs #############################

Callers

nothing calls this directly

Calls 4

_ssFunction · 0.85
StatisticsErrorClass · 0.85
_decimal_sqrt_of_fracFunction · 0.85
_float_sqrt_of_fracFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…