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.
- Check my parameters — score one distribution against 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 and AIC/BIC for each.
- Check my parameters scores one distribution against parameters you type, with CDF/PDF overlays. It does not fit anything for you - it grades the numbers in the boxes.
- Data view — histogram, ECDF, empirical PDF (counts: empirical PMF), box plot, Q-Q plot against the distribution you chose, run chart and sorted run chart, and summary statistics. ECDF, PDF/PMF and the run charts have a pan/zoom toolbar and optional grid lines.
- 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.
- Conditional probability — P(event | filters) for an event on the Use column, e.g. P(count > 500 | season == summer), with its all-rows baseline, the ratio, Bayes' reverse P(condition | event), and the model's value.
- 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.5.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.5.0.tar.gz | 64.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| distfitlab-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 122.3 kB
Release files / distfitlab-0.5.0.tar.gz
| Download URL | distfitlab-0.5.0.tar.gz |
|---|---|
| Size | 64.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0d2eec3e8e0b77161cb6ff3d85eb8edd0bd0ee48460ddb89782c3d803e419bc
|
|
BLAKE2b-256 checksum How to use checksums |
bcbf5ee95d18aa501352f90c60c8a1158369dd8073227ed23eae3a51e6708d95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Release files / distfitlab-0.5.0-py3-none-any.whl
| Download URL | distfitlab-0.5.0-py3-none-any.whl |
|---|---|
| Size | 57.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6474c86278010aaabd75df54cc4a17a1ed67cf3593da55c64fca2765a9452944
|
|
BLAKE2b-256 checksum How to use checksums |
9a7a8fb55167372b56e6f5c0b63df954f74a79d6410dfb6bcad70ed3047c6bcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|