mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Fix negative bandwidth test and add online code path test. (gh-118600)
This commit is contained in:
parent
9c13d9e37a
commit
5092ea238e
2 changed files with 24 additions and 9 deletions
|
@ -1791,9 +1791,8 @@ def kde_random(data, h, kernel='normal', *, seed=None):
|
|||
if h <= 0.0:
|
||||
raise StatisticsError(f'Bandwidth h must be positive, not {h=!r}')
|
||||
|
||||
try:
|
||||
kernel_invcdf = _kernel_invcdfs[kernel]
|
||||
except KeyError:
|
||||
kernel_invcdf = _kernel_invcdfs.get(kernel)
|
||||
if kernel_invcdf is None:
|
||||
raise StatisticsError(f'Unknown kernel name: {kernel!r}')
|
||||
|
||||
prng = _random.Random(seed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue