accumulator

This module accumulates statistical values to analyze its mean, standard deviation and moments.

class accumulator.Accumulator(num_moments=3, values=None)[source]

Accumulate values.

num_moments()[source]

Return the number of moments.

add(value)[source]

Add a value or values to the moments.

num_values()[source]

Return the number of values.

mean()[source]

Return the mean.

>>> from pyfeasst import accumulator
>>> acc = accumulator.Accumulator()
>>> acc.add(1.)
>>> acc.add(2.)
>>> acc.add(4.)
>>> acc.add([3, 5, 7])
>>> round(float(acc.mean()), 6)
3.666667
stdev()[source]

Return the standard deviation.

>>> from pyfeasst import accumulator
>>> acc = accumulator.Accumulator(values=[1, 2, 3, 4, 5, 7])
>>> round(float(acc.stdev()), 6)
2.160247
sum_moment(power)[source]

Return the sum of the moment, x**power.

>>> from pyfeasst import accumulator
>>> acc = accumulator.Accumulator(values=[1, 2, 3, 4, 5, 7])
>>> round(float(acc.sum_moment(0)), 6)
6.0
>>> round(float(acc.sum_moment(1)), 6)
22.0
>>> round(float(acc.sum_moment(2)), 6)
104.0