RunStats is an Apache2 licensed Python module for computing online statistics and linear regression in a single pass. It is designed for efficiently processing large data streams or generators where previous values are not retained, making it suitable for long-running systems. The library, currently at version 2.0.0, is actively maintained and provides numerically stable calculations for various statistical measures and regression coefficients. [1, 2, 3]
pip install runstatsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `Statistics` class to compute running statistics like mean, standard deviation, min, and max, and the `Regression` class to calculate slope, intercept, and correlation for a stream of (x, y) pairs. Values are added one by one using the `push` method. [2]
Ensure Cython is installed (`pip install Cython`) before installing `runstats`, or check the installation logs for Cython compilation success.
Do not use `len()` on `ExponentialStatistics` objects. If you need to track the number of pushes, maintain a separate counter.
Be mindful of the order of `ExponentialStatistics` objects during combination to control the resulting decay rate. If specific weighting or a new decay rate is desired, consider creating a new `ExponentialStatistics` object and manually pushing combined values or explicitly setting the decay rate if the API allows.
Install the library using pip: `pip install runstats`.
Ensure you are using the correct class for the desired calculation. Use `Regression` for linear regression attributes (`slope`, `intercept`, `correlation`) and `Statistics` for basic descriptive statistics (`mean`, `stddev`, `minimum`, etc.).
The `ExponentialStatistics` class does not track a fixed count due to its decaying nature. If a count of operations is needed, implement a manual counter alongside the `ExponentialStatistics` object.
No dependency data recorded yet.