Metadata-Version: 2.4
Name: larzstats
Version: 0.1.0
Summary: Descriptive statistics, correlation, linear regression, and the normal distribution in pure Python. No numpy/scipy, zero dependencies.
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzstats
Project-URL: Repository, https://github.com/larz-scripter/larzstats
Project-URL: Issues, https://github.com/larz-scripter/larzstats/issues
Keywords: statistics,stats,mean,median,regression,correlation,quantile,normal-distribution,numpy-alternative,data,zero-dependency
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzstats

**Statistics without numpy/scipy. Pure Python, zero dependencies.**

The everyday statistics you reach for on a list of numbers — central tendency and
spread, quantiles, correlation, a least-squares fit you can predict from, and the
normal distribution — all from `math` alone, working back to Python 3.8 (where the
stdlib `statistics` module still lacks regression and correlation).

```python
from larzstats import describe, linregress, correlation, normal_cdf

describe([2, 4, 4, 4, 5, 5, 7, 9])
# {'count': 8, 'mean': 5.0, 'std': 2.13.., 'min': 2, 'q1': 4.0,
#  'median': 4.5, 'q3': 5.5, 'max': 9}

fit = linregress([1, 2, 3, 4], [2.1, 3.9, 6.1, 8.0])
fit.slope, fit.r2, fit.predict(5)

correlation([1, 2, 3], [2, 4, 6])      # 1.0
normal_cdf(1.96)                       # 0.975
```

## Why

- **The functions the stdlib doesn't give you (on 3.8).** `linregress` (with
  `slope`/`intercept`/`r`/`r2` and `predict()`), `correlation`, `covariance`,
  `describe`, `iqr`, `z_score`, `normal_cdf`/`normal_pdf` — no `statistics`
  version gate, no numpy.
- **Complete descriptives.** mean/median/mode, geometric & harmonic means, sample
  and population variance/stdev, quantiles/percentiles/quartiles.
- **Zero dependencies.** For scripts, dashboards, tests, and teaching — anywhere
  numpy is overkill. Pairs with
  [larzchart](https://github.com/larz-scripter/larzchart) to plot the results.

## Install

```bash
pip install larzstats
```

## Usage

```python
from larzstats import (mean, median, mode, variance, stdev, quantile, percentile,
                       iqr, describe, correlation, linregress, normal_cdf, z_score)

mean(xs); median(xs); stdev(xs)            # sample by default; sample=False for population
quantile(xs, 0.9); percentile(xs, 90); iqr(xs)
describe(xs)                               # summary dict

fit = linregress(x, y); fit.predict(x0); fit.r2
correlation(x, y)                          # -1..1
normal_cdf(x, mu=0, sigma=1); z_score(x, mu, sigma)
```

## Tests

```bash
python -m unittest discover -s tests -v   # 20 tests incl. regression + normal CDF
```

## The Larz stack

One of 30+ pure-Python, zero-dependency libraries at
[github.com/larz-scripter](https://github.com/larz-scripter).

## License

MIT © larz-scripter
