aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/statistics.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2022-05-03 03:41:46 -0500
committerGitHub <noreply@github.com>2022-05-03 03:41:46 -0500
commitec8d3adb99f1ad93786fed5c1def5119b6ec73c0 (patch)
tree8f7492d60020447ef5cad9f3be853ca9fc05321d /Lib/statistics.py
parent9b027d4cea57e98c76f5176cc3188dc81603356c (diff)
downloadcpython-ec8d3adb99f1ad93786fed5c1def5119b6ec73c0.tar.gz
cpython-ec8d3adb99f1ad93786fed5c1def5119b6ec73c0.zip
The stdev calculation is more accurate computing its own mean (#92220)
Diffstat (limited to 'Lib/statistics.py')
-rw-r--r--Lib/statistics.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/statistics.py b/Lib/statistics.py
index f3bc9a1f346..6e6d62c4a0e 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -1173,8 +1173,7 @@ class NormalDist:
"Make a normal distribution instance from sample data."
if not isinstance(data, (list, tuple)):
data = list(data)
- xbar = fmean(data)
- return cls(xbar, stdev(data, xbar))
+ return cls(mean(data), stdev(data))
def samples(self, n, *, seed=None):
"Generate *n* samples for a given mean and standard deviation."