grantjenks/python-runstats

Allow weighting of Statistics

Closed this issue · 3 comments

Let's say I have two Statistics object and want to merge them by adding them. This perfectly works right now since __add__ is implemented. But what if I want to weight them before I merge? Let's say Statistics object a has a count of 1000 and I want to treat those events as only 10 before adding it to Statistics object b. Therefore it would be really cool to be able to say c = 0.01*a + b.

The implementation of this with the help of __mul__ is quite easy and I will provide a PR if this feature is accepted.

Sounds fine to me. Please submit a pull request with tests.

Thanks a lot for merging so fast. Will you make a new release soon?

Yep, version 1.6.0 or higher will have the weighting feature.