Return the square root of the sample variance. See ``variance`` for arguments and other details. >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 1.0810874155219827
(data, xbar=None)
| 905 | |
| 906 | |
| 907 | def stdev(data, xbar=None): |
| 908 | """Return the square root of the sample variance. |
| 909 | |
| 910 | See ``variance`` for arguments and other details. |
| 911 | |
| 912 | >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) |
| 913 | 1.0810874155219827 |
| 914 | |
| 915 | """ |
| 916 | T, ss, c, n = _ss(data, xbar) |
| 917 | if n < 2: |
| 918 | raise StatisticsError('stdev requires at least two data points') |
| 919 | mss = ss / (n - 1) |
| 920 | if issubclass(T, Decimal): |
| 921 | return _decimal_sqrt_of_frac(mss.numerator, mss.denominator) |
| 922 | return _float_sqrt_of_frac(mss.numerator, mss.denominator) |
| 923 | |
| 924 | |
| 925 | def pstdev(data, mu=None): |
no test coverage detected