On this page
statistics.kde
Prev: statistics.harmonic_mean | Up: statistics | Next: statistics.kde_random
Rel: statistics.correlation, statistics.covariance, statistics.fmean, statistics.geometric_mean
Ref: docs.python.org — statistics.kde
Tags: #public #python3 #stdlib #statistics
Import
import statistics
from statistics import kde
Signature & Overview
statistics.kde(data, h, kernel='normal', *, cumulative=False)
Kernel Density Estimation: Create a continuous probability density function or cumulative distribution function from discrete samples.
Usage
import statistics
# Python 3.13+: kernel density estimation returning a callable PDF
if hasattr(statistics, 'kde'):
pdf = statistics.kde([1.0, 2.0, 2.5, 3.0], h=0.5)
assert pdf(2.0) > 0
Gotchas
- Requires Python 3.13+: Bandwidth
hmust be> 0.
REPL Inspect
from statistics import kde
help(kde)
Linked from
Related notes
- tuts/python3/stdlib_module/statistics/harmonic_mean Linked here; links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/kde_random Linked here; links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/statistics/correlation Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/covariance Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/fmean Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/geometric_mean Linked here; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/linear_regression shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/mean shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/median shared tags: #statistics, #stdlib