

def test_by_mean():
    ((chunk, chunk_expr), (agg, agg_expr)) = split(t, by(t.name, avg=t.amount.mean()))
    assert chunk_expr.isidentical(by(chunk.name, avg_total=chunk.amount.sum(), avg_count=chunk.amount.count()))
    assert agg_expr.isidentical(by(agg.name, avg=(agg.avg_total.sum() / agg.avg_count.sum())))

dataset/ETHPy150Open blaze/blaze/blaze/expr/tests/test_split.py test_by_mean/original