distfitlab
Interactive distribution fitting in Jupyter. Simulate or load data, fit many probability distributions at once, see which one fits best, and inspect the data — from a single widget UI.
Two apps behind one switch:
- Continuous — 18 distributions: Normal, Exponential, Gamma, Rayleigh, Weibull,
Lognormal, Loglogistic, Inverse Gaussian, Beta, GEV, Logistic, Laplace, Chi-squared,
Chi, Nakagami, Rician, Cauchy, Student-T. Fitted with
scipy.stats. - Discrete — 5 count distributions: Poisson, Binomial, Geometric, Negative Binomial,
Zero-Inflated Poisson. SciPy has no
.fitfor these, so the fitters are written here.
Install
pip install distfitlab
Optional readers and the interactive run charts are extras:
pip install "distfitlab[all]"
For the latest development version, install from GitHub instead:
pip install "distfitlab[all] @ git+https://github.com/rberangi/distfitlab.git".
| Extra | Adds |
|---|---|
excel |
.xlsx, .xls |
parquet |
.parquet, .feather, .arrow |
spss |
.sav, .dta, .sas7bdat, .xpt |
hdf5 |
.h5, .hdf5 |
zoom |
pan/zoom toolbar on the run charts |
all |
all of the above |
After installing
distfitlab is a widget app, so it runs inside a notebook — not in a plain Python script or terminal.
1. Open a notebook in the same Python environment you installed into:
pip install jupyterlab # skip if you already have Jupyter
jupyter lab
VS Code works too: create a .ipynb file and select that Python as the kernel.
Notebook 7 is also fine — anywhere ipywidgets renders.
2. Start the app in a notebook cell:
from distfitlab import main
main() # opens on the continuous app
# main("Discrete") # opens on the discrete app
3. Use the UI that appears below the cell:
- Data source — simulate data, or choose From file to upload a file (or enter a path) and pick the column.
- Fit All — fit every distribution and get a table ranked best-first.
- Fit — try one distribution with parameters you type.
- Visualize data — histogram, ECDF, box plot, Q-Q plot, run charts and summary stats.
- Save results — write the table and figures to an
outputs/folder next to the notebook.
A ready notebook is in examples/quickstart.ipynb
(in the repository; a pip install does not include it), and every control is explained in
docs/guide.md.
If something doesn't work
| Symptom | Fix |
|---|---|
ModuleNotFoundError: No module named 'distfitlab' |
The notebook kernel is a different Python from the one pip installed into. Run %pip install "distfitlab[all]" in a cell, then restart the kernel. |
Text such as VBox(children=...) instead of the UI |
The frontend can't render widgets. Use JupyterLab 3+, Notebook 7, or VS Code with the Jupyter extension. |
| No pan/zoom toolbar on the run charts | ipympl is missing. Install the zoom or all extra, then restart the kernel. |
What you get
- Fit All fits every distribution and ranks them best-first by the largest gap between the empirical and theoretical CDF, with the parameters for each.
- Fit scores one distribution against parameters you type, with CDF/PDF overlays.
- Data view — histogram (or counts bar chart), ECDF, box plot, Q-Q plot against the distribution you chose, run chart and sorted run chart with a pan/zoom toolbar, and summary statistics.
- File data — CSV, TSV, Excel, JSON, Parquet, Feather, SPSS/Stata/SAS and HDF5; a stack of filter conditions across columns; cleaning (drop NaN, drop ≤ 0, percentile trim, drop duplicates); and Group by, which fits every group and ranks them.
- loc = 0 option, for when a distribution should be anchored at the origin.
- Save results writes the table, the samples and the figures to a timestamped folder.
Requirements
Python 3.9+, with numpy, pandas, scipy, matplotlib and ipywidgets. Developed
and tested on Python 3.12.
Documentation
The full walkthrough — every control, the parameter conventions, supported file types,
troubleshooting and how the fitting works — is in docs/guide.md.
License
MIT — see LICENSE.
Citation
If this helps with published work, please cite the libraries it stands on: SciPy, NumPy, pandas, Matplotlib and ipywidgets.
Metadata
Release files for distfitlab 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| distfitlab-0.2.0.tar.gz | 49.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| distfitlab-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.4 kB
Release files / distfitlab-0.2.0.tar.gz
| Download URL | distfitlab-0.2.0.tar.gz |
|---|---|
| Size | 49.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee7825fe8a1a6db4034bdc23151c081250d81a33fb91698fdb9c1d26c0f29c41
|
|
BLAKE2b-256 checksum How to use checksums |
a913a7e073d61adc9a01381ef106f8397a059a249aef73e68b4fca3bc67d228b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Release files / distfitlab-0.2.0-py3-none-any.whl
| Download URL | distfitlab-0.2.0-py3-none-any.whl |
|---|---|
| Size | 46.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47f4c00e3683af1811e7c5b2e3cdcc3740a6cb40335dbbf55a5351bf0df89c21
|
|
BLAKE2b-256 checksum How to use checksums |
e36f43d7563af6f79f6badff71f3c0fa6d8ae1470b14f49ce4c539390e681ae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|