Skip to main content

Statistics for Humans

CI

Install

From PyPi

pip install verysimplestats

From GitHub (with pip)

pip install git+https://github.com/PierreSelim/verysimplestats.git

Tests

Doctests are embedded in the source. Run with:

uv run pytest --cov=verysimplestats --cov-report=term-missing

Examples

Mean value

>>> import verysimplestats as stats
>>> stats.mean([1, 2, 3, 4, 5])
3.0

Median value

>>> import verysimplestats as stats
>>> stats.median([5, 2, 6, 4, 1, 3])
3.5

Linear regression

>>> import verysimplestats as stats
>>> lm = stats.linear_regression([1, 2, 3], [1, 3, 4.5])
>>> (lm.slope, lm.intercept, lm.rsquared)
(1.7499999999999984, -0.6666666666666634, 0.9932432432432422)
>>> [round(e, 4) for e in lm.residuals]
[-0.0833, 0.1667, -0.0833]

Variance is computed only for list of length greater or equal to 2

>>> import verysimplestats as stats
>>> stats.variance([1])
Traceback (most recent call last):
    ...
ValueError: Variance only exists for list with at least 2 elements [1]

Supported functions

Functions Examples
mean(x: list) -> float mean([1, 2, 3, 4, 5])
median(x: list) -> float median([5, 2, 6, 4, 1, 3])
variance(x: list) -> float variance([1, 2, 3, 4, 5])
standard_deviation(x: list) -> float standard_deviation([1, 2, 3, 4, 5])
covariance(x: list, y: list) -> float covariance([1, 2, 3, 4, 5], [1, 2, 3, 4, 5])
correlation(x: list, y: list) -> float correlation([1, 2, 3, 4, 5], [1, 2, 3, 4, 5])
rsquared(x: list, y: list) -> float rsquared([1, 2, 3], [1, 3, 4.5])
ordinary_least_square(x: list, y: list) -> (float, float) ordinary_least_square([1, 2, 3], [1, 3, 4.5])
linear_forecast(slope: float, intercept: float, value: float) -> float linear_forecast(2, -1, 3)
residuals(slope: float, intercept: float, x: float, y: float) -> float residuals(1.75, -0.667, [1, 2, 3], [1, 3, 4.5])
linear_regression(x: list, y: list) -> LinearRegressionFit linear_regression([1, 2, 3], [1, 3, 4.5])

License (MIT)

The MIT License (MIT)

Copyright (c) 2016 Pierre-Selim

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

Metadata

Release files for verysimplestats 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for verysimplestats 2.0
File Size Uploaded Provenance
verysimplestats-2.0.tar.gz 5.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for verysimplestats 2.0
File Interpreter ABI Platform
verysimplestats-2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / verysimplestats-2.0.tar.gz

Download URL verysimplestats-2.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5e250095578daae28866428c585c04ae0d886ea71b1cd96a24c07b56da4663d0
BLAKE2b-256 checksum
How to use checksums
6099772b070999a6e96340168fb09b54e2c76b4a2499a9991a021f224235fbca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / verysimplestats-2.0-py3-none-any.whl

Download URL verysimplestats-2.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3642b8e0520332c6f1e6779305508d3638f3bd38927cc6c46bb9d581c24ea569
BLAKE2b-256 checksum
How to use checksums
8549014e38103ba2eb5fe91ca812d114310d53f1aa2c05c81f95046a380ee4ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for verysimplestats 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page