ContinuumIO/blaze — pull request #836 by mrocklin (2014-11-18 01:20:55+00:00)
Title: Split more reductions

Reductions like mean, std, and var are slightly more complex to compute in chunks. They accumulate a few reductions like total and count.

```Python
In [1]: from blaze import *

In [2]: from blaze.expr.split import split

In [3]: t = Symbol('t', '100 * {a: int, b: int}')

In [4]: split(t, t.a.mean())
Out[4]:
((chunk, summary(count=count(chunk.a), total=sum(chunk.a), keepdims=True)),
(aggregate, sum(aggregate.total) / sum(aggregate.count)))

In [5]: split(t, t.a.std())
Out[5]:
((chunk,
summary(n=count(chunk.a), x=sum(chunk.a), x2=sum(chunk.a ** 2), keepdims=True)),
(aggregate,
sqrt((sum(aggregate.x2) - (sum(aggregate.x) ** 2)) / sum(aggregate.n))))
```