Skip to main content

A streaming statistics library

Project description

Python package

Streaming statistics

This is module for streaming statistics. It can efficiently calculate statistics on a stream of numbers in a minimum amount of memory.

It provides the following statistics:

Statistic Description
n Number of values
min Minimum value
max Maximum value
sum Sum of values
mean Mean value
stddev Standard deviation
variance Variance

In addition to the above statistics, it also provides the following percentiles: 1st, 5th, 25th, 50th, 75th, 95th, and 99th.

Here is an example result:

{
  "n": 177966,
  "mean": 237.02426306148718,
  "variance": 184870.5448188569,
  "stddev": 429.9657484252169,
  "min": 0,
  "max": 33408,
  "sum": 42182260,
  "1st": 5.002829575110743,
  "5th": 17.994143369901202,
  "10th": 25.791844500743554,
  "25th": 49.90296094906744,
  "50th": 100.4945677085671,
  "75th": 242.2894312639693,
  "90th": 607.9931874110874,
  "95th": 925.3552129773512,
  "99th": 1826.5794537820188
}

A script, script/stats will read numbers from standard input and print the statistics to standard output.

Installation

This code uses the poetry system to install Python dependencies. To install, clone this repository, and then:

$ poetry install
$ poetry shell

It is also available as a Python package on PyPI.

$ pip install streaming_statistics

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streaming_statistics-1.0.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

streaming_statistics-1.0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file streaming_statistics-1.0.2.tar.gz.

File metadata

  • Download URL: streaming_statistics-1.0.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0

File hashes

Hashes for streaming_statistics-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2083d2a01cef02664754deca986d21d46344a1257f230af678138c7a1d3f373f
MD5 e897590b7dcec47a6f2096ebf6564105
BLAKE2b-256 e0ef1a7a258b707fb05a95ce9be76c128d5fb045ce24568cbfabe94b7ddadde5

See more details on using hashes here.

File details

Details for the file streaming_statistics-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for streaming_statistics-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 26d837ff5147a97c2006fb98c892f912b56ea51151d6e2277d7dd7bd9bc217d8
MD5 3e71d9a2cdae23be5f46273337abd173
BLAKE2b-256 73d94092e1ce55b17b0d81bacb172d654bcc41d2653569487b57c07ab1aed47c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page