diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-06-13 23:56:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-13 23:56:15 (GMT) |
commit | 55c1d21761e2e5feda5665065ea9e2280fa76113 (patch) | |
tree | 601c6ea02f21ff56aaabf03bf42883692fe707bb /Lib/statistics.py | |
parent | bda4cc82de06490d982e199e5e49aaed390461ba (diff) | |
download | cpython-55c1d21761e2e5feda5665065ea9e2280fa76113.zip cpython-55c1d21761e2e5feda5665065ea9e2280fa76113.tar.gz cpython-55c1d21761e2e5feda5665065ea9e2280fa76113.tar.bz2 |
bpo-40855: Fix ignored mu and xbar parameters (GH-20835) (#GH-20862)
Diffstat (limited to 'Lib/statistics.py')
-rw-r--r-- | Lib/statistics.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/statistics.py b/Lib/statistics.py index c76a6ca..93a4633 100644 --- a/Lib/statistics.py +++ b/Lib/statistics.py @@ -682,8 +682,10 @@ def _ss(data, c=None): calculated from ``c`` as given. Use the second case with care, as it can lead to garbage results. """ - if c is None: - c = mean(data) + if c is not None: + T, total, count = _sum((x-c)**2 for x in data) + return (T, total) + c = mean(data) T, total, count = _sum((x-c)**2 for x in data) # The following sum should mathematically equal zero, but due to rounding # error may not. |