mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Refactor (mostly rearrange) the statistics module (gh-119930)
This commit is contained in:
parent
c618f7d80e
commit
e378dc15b5
2 changed files with 808 additions and 760 deletions
1563
Lib/statistics.py
1563
Lib/statistics.py
File diff suppressed because it is too large
Load diff
|
@ -2435,12 +2435,13 @@ class TestKDE(unittest.TestCase):
|
||||||
self.assertGreater(f_hat(100), 0.0)
|
self.assertGreater(f_hat(100), 0.0)
|
||||||
|
|
||||||
def test_kde_kernel_invcdfs(self):
|
def test_kde_kernel_invcdfs(self):
|
||||||
kernel_invcdfs = statistics._kernel_invcdfs
|
kernel_specs = statistics._kernel_specs
|
||||||
kde = statistics.kde
|
kde = statistics.kde
|
||||||
|
|
||||||
# Verify that cdf / invcdf will round trip
|
# Verify that cdf / invcdf will round trip
|
||||||
xarr = [i/100 for i in range(-100, 101)]
|
xarr = [i/100 for i in range(-100, 101)]
|
||||||
for kernel, invcdf in kernel_invcdfs.items():
|
for kernel, spec in kernel_specs.items():
|
||||||
|
invcdf = spec['invcdf']
|
||||||
with self.subTest(kernel=kernel):
|
with self.subTest(kernel=kernel):
|
||||||
cdf = kde([0.0], h=1.0, kernel=kernel, cumulative=True)
|
cdf = kde([0.0], h=1.0, kernel=kernel, cumulative=True)
|
||||||
for x in xarr:
|
for x in xarr:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue