8000 Add statistics recipe for sampling from an estimated probability density distribution by rhettinger · Pull Request #117221 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Add statistics recipe for sampling from an estimated probability density distribution #117221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Mar 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Separate core logic from formatting in the example
  • Loading branch information
rhettinger committed Mar 26, 2024
commit e827d8a549da6566b2862c7a7d086b73a8582fa0
5 changes: 3 additions & 2 deletions Doc/library/statistics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1187,9 +1187,10 @@ For example:
.. doctest::

>>> discrete_samples = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]
>>> rand = kde_random(discrete_samples, h=1.5)
>>> seed(8675309)
>>> [round(rand(), 1) for i in range(10)]
>>> rand = kde_random(discrete_samples, h=1.5)
>>> selections = [rand() for i in range(10)]
>>> [round(x, 1) for x in selections)]
[0.7, 6.2, 1.2, 6.9, 7.0, 1.8, 2.5, -0.5, -1.8, 5.6]

.. testcode::
Expand Down
0