Skip to main content

Online stats in python, based in generators with send

Project description

Code style: black Checked with mypy Tests Status

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 import ma # moving average

>>>  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.

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 Correlation

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

onstats-0.9.3.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

onstats-0.9.3-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

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