Generators Based Online Statistics
This package implement online statistics written using python generators, with the only depencency of numpy.
It can calculate basic stats in an online manner with good stability.
The Repo focus in simplicity and compousability, reliying 100% on python Generators.
By desingn window operations increase in window size till the desired size instead of returning Nan in the initialization period as pd.rolling does.
install
poetry add onstats
pip install onstats
How to use:
Import the window / rolling statistic you want to compute and send the values to it:
>>> from onstats.stats import ma # moving average
>>> from onstats.util import send
>>> gma = ma(2) # with window 2
>>> gma.send(3)
3
>>> gma.send(5)
4
>>> gma.send(5)
5
If w = 0 the window is infinitelly large , we will compute the normal average.
You can also feed all the iterator directly:
>>> gma = ma(2) # with window 2
>>> send(gma, [3,5,5])
5
Or as an iterator
>>> gma = ma(2) # with window 2
>>> for d in isend(gma, [3,5,5]):
>>> print(d)
3
4
5
You can also pass 2d np.arrays:
>>> gma = ma(2) # with window 2
>>> for d in isend(gma, np.array([[0,0],[1,2],[1,4]])):
>>> print(d)
[0,0]
[0.5,1]
[1,3]
Supported Stats:
| rolling | window | infinite | Ddoff | Description |
|---|---|---|---|---|
| ma | ✅ | ✅ | Moving Average | |
| ema | ✅ | Exponential Moving Average | ||
| var | ✅ | ✅ | ✅ | Variance |
| ath | ✅ | All Time High | ||
| wsum | ✅ | ✅ | Windowed Sum | |
| cov_xy | ✅ | ✅ | Covariance | |
| corr_xy | ✅ | ✅ | Correlation | |
| auto_corr | ✅ | ✅ | Auto Correlation |
Release files for onstats 0.9.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onstats-0.9.4.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onstats-0.9.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / onstats-0.9.4.tar.gz
| Download URL | onstats-0.9.4.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8efe95b7f437b637de3d774ac730a9438f5fd28d0e4fdfdcfbac087587a17348
|
|
BLAKE2b-256 checksum How to use checksums |
b3821db1ebc30eeb24ce072e688b0895c912cabd0f430c2e24705b199aa77727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-9-generic
|
Release files / onstats-0.9.4-py3-none-any.whl
| Download URL | onstats-0.9.4-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59a6e08d2efcce7c38c8671335cdff04b8d9d9e4fcc16a24623d0b8f35428f5b
|
|
BLAKE2b-256 checksum How to use checksums |
8ec989bdc5d32381ce2e2eaef3aa4204533f19d4bac2c146eecbe072acd76435
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-9-generic
|