Skip to main content

Streaming statistics calculator

This tool allows users to calculate statistical features such as mean, median, variance, standard deviation, and skewness, along with the minimum and maximum of a series of numbers in real time without storing them. It can calculate all these features in O(1) space complexity.

This is very useful when dealing with large series of numbers on a resource contrained system. It uses different mathematical logic to keep track of certain variables for its functioning.

Installation

pip install streaming-stats

Execution

from streaming_stats import StreamingStats

example_series = [4.45, -2, 7.1, -8.7, 3, -2, 45, ,6, -12.3, 53.6, 2.7, 0, 3.6]

object = StreamingStats()

for number in example_series:
  object.update(number)

print(object.get_mean())
print(object.get_median())
print(object.get_std())
print(object.get_variance())
print(object.get_min())
print(object.get_max())
print(object.get_skewness())

Other features of the tool includes merging of two different StreamingStats objects. There can be situation when users would need to find variance (suppose) of the combined series. The merge() method helps in achieving the same.

object1 = StreamingStats()
object2 = StreamingStats()

for number in series1:
  object1.update(number)

for number in series2:
  object.update(number)

merged_object = object1.merge(object2)

print(merged_object.get_mean())
print(merged_object.get_median())
print(merged_object.get_std())
print(merged_object.get_variance())
print(merged_object.get_min())
print(merged_object.get_max())
print(merged_object.get_skewness())

Note that the example_series list was created just for demonstration. Users don't need to have the numbers of the series stored anywhere. The numbers can be added to the StreamingStats object as soon as it is recieved.

Metadata

Release files for streaming-stats 0.3

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

Source distribution (sdist)

Source distribution for streaming-stats 0.3
File Size Uploaded Provenance
streaming_stats-0.3.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for streaming-stats 0.3
File Interpreter ABI Platform
streaming_stats-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / streaming_stats-0.3.tar.gz

Download URL streaming_stats-0.3.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3caad1cf211aa5caf7baad3c11041c097579b24ca078df61c8fd81b3548d4318
BLAKE2b-256 checksum
How to use checksums
ec4dc84bc48da6c6b1609cb6552488652012f820fc0f6dce59c37c1a61674c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.13

Release files / streaming_stats-0.3-py3-none-any.whl

Download URL streaming_stats-0.3-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
783e29960d5000e0f58e4e49eb9021cfd5ec98bb97d3fbd43575cc569d7ad516
BLAKE2b-256 checksum
How to use checksums
f0ead6b5521f9201efb4cc6ff23544e497019a9531686862e360d64da531ad79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.13

Security for streaming-stats 0.3

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 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