bpo-40855: Fix ignored mu and xbar parameters (GH-20835)

This commit is contained in:
Raymond Hettinger 2020-06-13 15:55:52 -07:00 committed by GitHub
parent dea3223740
commit d71ab4f738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View file

@ -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.