Wrote a new library - Comments and suggestions please!
Tal Einat
taleinat at gmail.com
Mon Sep 26 07:23:04 EDT 2011
The library is called RunningCalcs and is useful for running several
calculations on a single iterable of values.
https://bitbucket.org/taleinat/runningcalcs/
http://pypi.python.org/pypi/RunningCalcs/
I'd like some input on how this could be made more useful and how to
spread the word about it.
The library contains the base RunningCalc class and implementations of
sub-classes for common calculations: sum, min/max, average, variance &
standard deviation, n-largest & n-smallest. Additionaly a utility
function apply_in_parallel() is supplied which makes running several
calculations on an iterable easy (and fast!).
Straight-forward example:
mean_rc, stddev_rc = RunningMean(), RunningStdDev()
for x in values:
mean_rc.feed(x)
stddev_rc.feed(x)
mean, stddev = mean_rc.value, stddev_rc.value
Examples using apply_in_parallel():
mean, stddev = apply_in_parallel(values, [RunningMean(),
RunningStdDev()])
five_smallest, five_largest = apply_in_parallel(values,
[RunningNSmallest(5), RunningNLargest(5)])
Comments and suggestions would be highly appreciated!
More information about the Python-list
mailing list