Example #1
0
def test_Distinct():
    t = TableSymbol('t', '{name: string, amount: int32}')
    r = distinct(t['name'])
    print(r.dshape)
    assert r.dshape  == dshape('var * {name: string}')

    r = t.distinct()
    assert r.dshape  == t.dshape
Example #2
0
def test_Distinct():
    t = symbol('t', 'var * {name: string, amount: int32}')
    r = distinct(t['name'])
    print(r.dshape)
    assert r.dshape == dshape('var * string')
    assert r._name == 'name'

    r = t.distinct()
    assert r.dshape == t.dshape
Example #3
0
def test_Distinct():
    t = TableSymbol("t", "{name: string, amount: int32}")
    r = distinct(t["name"])
    print(r.dshape)
    assert r.dshape == dshape("var * string")
    assert r._name == "name"

    r = t.distinct()
    assert r.dshape == t.dshape
Example #4
0
def test_distinct():
    dftoobig = DataFrame(
        [['Alice', 'F', 100, 1], ['Alice', 'F', 100, 1], [
            'Alice', 'F', 100, 3
        ], ['Drew', 'F', 100, 4], ['Drew', 'M', 100, 5], ['Drew', 'F', 100, 4],
         ['Drew', 'M', 100, 5], ['Drew', 'M', 200, 5], ['Drew', 'M', 200, 5]],
        columns=['name', 'sex', 'amount', 'id'])
    d_t = distinct(tbig)
    d_df = compute(d_t, dftoobig)
    tm.assert_frame_equal(d_df, dfbig)
    # Test idempotence
    tm.assert_frame_equal(compute(d_t, d_df), d_df)
Example #5
0
def test_distinct():
    dftoobig = DataFrame([['Alice', 'F', 100, 1],
                          ['Alice', 'F', 100, 1],
                          ['Alice', 'F', 100, 3],
                          ['Drew', 'F', 100, 4],
                          ['Drew', 'M', 100, 5],
                          ['Drew', 'F', 100, 4],
                          ['Drew', 'M', 100, 5],
                          ['Drew', 'M', 200, 5],
                          ['Drew', 'M', 200, 5]],
                         columns=['name', 'sex', 'amount', 'id'])
    d_t = distinct(tbig)
    d_df = compute(d_t, dftoobig)
    tm.assert_frame_equal(d_df, dfbig)
    # Test idempotence
    tm.assert_frame_equal(compute(d_t, d_df), d_df)
Example #6
0
def test_distinct():
    assert set(compute(distinct(t['name']), data)) == set(['Alice', 'Bob'])
    assert set(compute(distinct(t), data)) == set(map(tuple, data))
    e = distinct(t)
    assert list(compute(e, [])) == []
Example #7
0
def test_distinct():
    assert set(compute(distinct(t['name']), data)) == set(['Alice', 'Bob'])
    assert set(compute(distinct(t), data)) == set(map(tuple, data))
    e = distinct(t)
    assert list(compute(e, [])) == []