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.

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.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

streaming_statistics-1.0.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: streaming_statistics-1.0.0.tar.gz
  • Upload date:
  • Size: 2.3 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.0.tar.gz
Algorithm Hash digest
SHA256 cd8fb720d8b29d742a8f17dd22815a264efc3d140c6830c35353141a29d38b83
MD5 5f1c2bff034a0fc727b3174fb4a32832
BLAKE2b-256 8914aff8e3762b43485531bb8accdf42cf2eeafca6a021db758f6ac81b5a770d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_statistics-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c003521a4a18314158cb8a7ea81f1fd861fe42d5ebdfb2f4c6ec0abfd36694b4
MD5 f5587e48624eedd503e6001ebceea99c
BLAKE2b-256 1190a48a78ff5ee93b82fb54b71677694a430e362fa830aaafaf2d43a38041d0

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