Statistics of list of (x, y) pairs from calculator-style summation registers.
CONTENTS
Use this package to obtain summary statistics of a list of
There are no external dependencies on add-on packages such as numpy or scipy. Only the math package from the Python Standard Library is used.
Statistics may be calculated at any time from the summation registers.
The
In [1]: import pysumreg
In [2]: reg = pysumreg.SummationRegisters()
In [3]: reg.clear()
...: reg.add(1, -1)
...: reg.add(2, -2)
...: reg.add(3, -3)
...: print(f"{reg.mean_x=}")
...: print(f"{reg.stddev_x=}")
...: print(f"{reg.mean_y=}")
...: print(f"{reg.stddev_y=}")
...: print(f"{reg.min_x=}")
...: print(f"{reg.max_x=}")
...: print(f"{reg.min_y=}")
...: print(f"{reg.max_y=}")
...: print(f"{reg.x_at_max_y=}")
...: print(f"{reg.x_at_min_y=}")
...:
reg.mean_x=2.0
reg.stddev_x=1.0
reg.mean_y=-2.0
reg.stddev_y=1.0
reg.min_x=1
reg.max_x=3
reg.min_y=-3
reg.max_y=-1
reg.x_at_max_y=1
reg.x_at_min_y=3
In [4]: reg.clear()
...: reg.add(1, -1)
...: reg.add(2, -2)
...: reg.add(3, -3)
...: print(f"{reg.correlation=}")
...: print(f"{reg.intercept=}")
...: print(f"{reg.slope=}")
...:
reg.correlation=-1.0
reg.intercept=0.0
reg.slope=-1.0
In [5]: reg.clear()
...: reg.add(1, 0)
...: reg.add(2, 1)
...: reg.add(3, 0)
...: print(f"{reg.max_y=}")
...: print(f"{reg.centroid=}")
...: print(f"{reg.sigma=}")
...:
reg.max_y=1
reg.centroid=2.0
reg.sigma=0.0
In [6]: reg.add(1.5, 0.5)
...: reg.add(2.5, 0.5)
...: print(f"{reg.max_y=}")
...: print(f"{reg.centroid=}")
...: print(f"{reg.sigma=}")
...:
reg.max_y=1
reg.centroid=2.0
reg.sigma=0.3535533905932738
This package may be installed by any of these commands:
pip install pysumreg
conda install -c conda-forge pysumreg
mamba install -c conda-forge pysumreg
micromamba install -c conda-forge pysumreg
Release | PyPI | Conda-forge | Platforms |
---|---|---|---|
Python | Unit Tests | Code Coverage |
---|---|---|
- documentation: https://prjemian.github.io/pysumreg/latest
- source: https://github.com/prjemian/pysumreg