{"id":23925,"library":"kdepy","title":"KDEpy","description":"KDEpy is a Python library for kernel density estimation (KDE). It provides implementations of various KDE methods including naive, convolution, FFT, and tree-based approaches. Current version is 1.1.12. Release cadence is irregular, with updates primarily for compatibility and bug fixes.","status":"active","version":"1.1.12","language":"python","source_language":"en","source_url":"https://github.com/tommyod/KDEpy","tags":["kernel-density-estimation","statistics","probability","data-analysis","visualization"],"install":[{"cmd":"pip install kdepy","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Core numerical computations","package":"numpy","optional":false},{"reason":"Used for optional features like optimization","package":"scipy","optional":true},{"reason":"Used for plotting examples","package":"matplotlib","optional":true}],"imports":[{"note":"Package name uses uppercase KDE in import.","wrong":"from kdepy import KDE","symbol":"KDE","correct":"from KDEpy import KDE"},{"note":"","wrong":"","symbol":"FFTKDE","correct":"from KDEpy import FFTKDE"},{"note":"","wrong":"","symbol":"NaiveKDE","correct":"from KDEpy import NaiveKDE"},{"note":"","wrong":"","symbol":"TreeKDE","correct":"from KDEpy import TreeKDE"}],"quickstart":{"code":"import numpy as np\nfrom KDEpy import FFTKDE\n\n# Generate sample data\nnp.random.seed(123)\ndata = np.random.normal(0, 1, size=100)\n\n# Fit KDE\nkde = FFTKDE(bw='ISJ')\nx, y = kde.fit(data).evaluate(1024)\n\n# Plot\nimport matplotlib.pyplot as plt\nplt.plot(x, y)\nplt.show()","lang":"python","description":"Fit a kernel density estimate using FFT-based KDE with Improved Sheather-Jones bandwidth selection."},"warnings":[{"fix":"Use uppercase KDE in the import statement.","message":"The import path uses mixed case: `from KDEpy import ...`. Lowercase `from kdepy import ...` will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from KDEpy.bandwidth import Bandwidth` or rely on automatic bandwidth selection via `bw` parameter.","message":"The Bandwidth class is not exposed in the top-level namespace. Users may mistakenly attempt to import it directly from KDEpy.","severity":"gotcha","affected_versions":"all"},{"fix":"Explicitly specify `bw='silverman'` if you need the old default.","message":"In KDEpy, the default bandwidth selection method changed between versions. In v1.1.0+, the default for FFTKDE is 'ISJ' (Improved Sheather-Jones) instead of 'silverman'.","severity":"gotcha","affected_versions":">=1.1.0"},{"fix":"Use `bw` instead of `bw_method`.","message":"The `bw_method` keyword argument was deprecated in v1.0.0 in favor of `bw`.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with `pip install kdepy` (lowercase) but import as `from KDEpy import ...`.","cause":"Incorrect import casing. The correct package name is 'KDEpy' with uppercase K, D, E.","error":"ModuleNotFoundError: No module named 'kdepy'"},{"fix":"Use `from KDEpy import FFTKDE` instead of `from KDEpy import KDE`.","cause":"Attempting to access a class that doesn't exist. KDEpy's main class is `FFTKDE`, not `KDE`.","error":"AttributeError: module 'KDEpy' has no attribute 'KDE'"},{"fix":"Ensure `bw` is a positive float, one of the supported string methods ('silverman', 'SCOTT', 'ISJ'), or a callable.","cause":"Passing an invalid value for `bw`. Common mistake: passing an integer or negative number.","error":"ValueError: The bandwidth parameter must be a positive float, a string, or a callable."},{"fix":"Use `kde.fit(data, bw='ISJ')` or `kde.fit(data)` after setting bw earlier.","cause":"Calling `fit` with positional argument after keyword argument, e.g., `kde.fit(bw='ISJ', data)`. Fit expects first positional argument as data.","error":"TypeError: fit() got multiple values for argument 'data'"},{"fix":"Upgrade to latest version and use `FFTKDE`. If stuck on old version, import `KDE`.","cause":"Old API. In earlier versions (<1.0) the main class was named `KDE`. It was renamed to `FFTKDE` in v1.0.","error":"ImportError: cannot import name 'KDE' from 'KDEpy' (unknown location)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}