In one pass, compute the mean and sample standard deviation as floats.
(data)
| 1756 | |
| 1757 | |
| 1758 | def _mean_stdev(data): |
| 1759 | """In one pass, compute the mean and sample standard deviation as floats.""" |
| 1760 | T, ss, xbar, n = _ss(data) |
| 1761 | if n < 2: |
| 1762 | raise StatisticsError('stdev requires at least two data points') |
| 1763 | mss = ss / (n - 1) |
| 1764 | try: |
| 1765 | return float(xbar), _float_sqrt_of_frac(mss.numerator, mss.denominator) |
| 1766 | except AttributeError: |
| 1767 | # Handle Nans and Infs gracefully |
| 1768 | return float(xbar), float(xbar) / float(ss) |
| 1769 | |
| 1770 | |
| 1771 | def _sqrtprod(x: float, y: float) -> float: |
no test coverage detected
searching dependent graphs…