Ejemplo n.º 1
0
def test_reductions():
    assert compute(mean(t['amount']), ddf) == 350 / 3
    assert compute(count(t['amount']), ddf) == 3
    assert compute(sum(t['amount']), ddf) == 100 + 200 + 50
    assert compute(min(t['amount']), ddf) == 50
    assert compute(max(t['amount']), ddf) == 200
    assert compute(var(t['amount']), ddf) == df.amount.var(ddof=0)
    assert compute(var(t['amount'], unbiased=True), ddf) == df.amount.var()
    assert compute(std(t['amount']), ddf) == df.amount.std(ddof=0)
    assert compute(std(t['amount'], unbiased=True), ddf) == df.amount.std()
Ejemplo n.º 2
0
def test_reductions():
    assert compute(mean(t['amount']), ddf) == 350 / 3.0
    assert compute(count(t['amount']), ddf) == 3
    assert compute(sum(t['amount']), ddf) == 100 + 200 + 50
    assert compute(min(t['amount']), ddf) == 50
    assert compute(max(t['amount']), ddf) == 200
    tm.assert_almost_equal(compute(var(t['amount']), ddf), df.amount.var(ddof=0))
    tm.assert_almost_equal(compute(var(t['amount'], unbiased=True), ddf), df.amount.var())
    assert compute(std(t['amount']), ddf) == df.amount.std(ddof=0)
    assert compute(std(t['amount'], unbiased=True), ddf) == df.amount.std()
Ejemplo n.º 3
0
def test_reductions():
    assert compute(mean(t['amount']), df) == 350./3
    assert compute(count(t['amount']), df) == 3
    assert compute(sum(t['amount']), df) == 100 + 200 + 50
    assert compute(min(t['amount']), df) == 50
    assert compute(max(t['amount']), df) == 200
    assert compute(nunique(t['amount']), df) == 3
    assert compute(nunique(t['name']), df) == 2
    assert compute(any(t['amount'] > 150), df) == True
    assert compute(any(t['amount'] > 250), df) == False
    assert compute(var(t['amount']), df) == df.amount.var(ddof=0)
    assert compute(var(t['amount'], unbiased=True), df) == df.amount.var()
    assert compute(std(t['amount']), df) == df.amount.std(ddof=0)
    assert compute(std(t['amount'], unbiased=True), df) == df.amount.std()