コード例 #1
0
ファイル: test_table.py プロジェクト: garfee/blaze
def test_all_construct():
    # Assert that the pretty pritner works for all of the
    # toplevel structures

    expected_ds = dshape('3, int')

    a = NDArray([1,2,3])
    str(a)
    repr(a)
    a.datashape._equal(expected_ds)

    a = Array([1,2,3])
    str(a)
    repr(a)
    a.datashape._equal(expected_ds)


    a = NDTable([(1, 1)])
    str(a)
    repr(a)
    #a.datashape._equal(expected_ds)

    a = Table([(1, 1)])
    str(a)
    repr(a)
コード例 #2
0
ファイル: test_table.py プロジェクト: renjiec/blaze-core
def test_record():
    expected_ds = dshape('1, {x: int32; y: float32}')

    t = NDTable([(1, 2.1), (2, 3.1)], dshape='1, {x: int32; y: float32}')
    t.datashape._equal(expected_ds)

    str(t)
    repr(t)
コード例 #3
0
ファイル: test_quickstart.py プロジェクト: renjiec/blaze-core
def test_custom_dshape():
    from blaze import NDTable, RecordDecl
    from blaze import int32, String

    class CustomStock(RecordDecl):
        name   = String
        max    = int32
        min    = int32

        def mid(self):
            return (self.min + self.max)/2

        __dummy = True

    a = NDTable([('GOOG', 120, 153)], CustomStock)
コード例 #4
0
ファイル: test_table.py プロジェクト: renjiec/blaze-core
def test_record_consume2():
    d = {'a': ["foo", "bar"], 'b': [4., 3., 2., 1.]}
    table = NDTable(d)
コード例 #5
0
ファイル: test_table.py プロジェクト: renjiec/blaze-core
def test_record_consume():
    expected_ds = dshape("4, {i: int64; f: float64}")

    d = {'i': [1, 2, 3, 4], 'f': [4., 3., 2., 1.]}
    t = NDTable(d)
    t.datashape._equal(expected_ds)
コード例 #6
0
ファイル: test_table.py プロジェクト: garfee/blaze
def test_record():
    data = NDTable([(1, 2.1)], '1, Record(x=int32, y=float)')