def test_discover():
    with tmpfile("hdf5") as fn:
        df.to_hdf(fn, "/a/b/data")
        df.to_hdf(fn, "/a/b/data2")
        df.to_hdf(fn, "/a/data")

        hdf = pd.HDFStore(fn)

        try:
            assert discover(hdf) == discover({"a": {"b": {"data": df, "data2": df}, "data": df}})
        finally:
            hdf.close()
Exemplo n.º 2
0
def test_discover():
    with tmpfile('hdf5') as fn:
        df.to_hdf(fn, '/a/b/data')
        df.to_hdf(fn, '/a/b/data2')
        df.to_hdf(fn, '/a/data')

        hdf = pd.HDFStore(fn)

        try:
            assert discover(hdf) == discover({'a': {'b': {'data': df, 'data2': df},
                                                    'data': df}})
        finally:
            hdf.close()
Exemplo n.º 3
0
def test_discover():
    with tmpfile('hdf5') as fn:
        df.to_hdf(fn, '/a/b/data')
        df.to_hdf(fn, '/a/b/data2')
        df.to_hdf(fn, '/a/data')

        hdf = pd.HDFStore(fn)

        try:
            assert discover(hdf) == discover({'a': {'b': {'data': df, 'data2': df},
                                                    'data': df}})
        finally:
            hdf.close()
Exemplo n.º 4
0
def test_fixed_shape():
    with tmpfile('.hdf5') as fn:
        df.to_hdf(fn, 'foo')
        r = resource('hdfstore://'+fn+'::/foo')
        assert isinstance(r.shape, list)
        assert discover(r).shape == (len(df),)
        r.parent.close()
def test_fixed_shape():
    with tmpfile(".hdf5") as fn:
        df.to_hdf(fn, "foo")
        r = resource("hdfstore://" + fn + "::/foo")
        assert isinstance(r.shape, list)
        assert discover(r).shape == (len(df),)
        r.parent.close()
Exemplo n.º 6
0
def test_fixed_shape():
    with tmpfile('.hdf5') as fn:
        df.to_hdf(fn, 'foo')
        r = resource('hdfstore://' + fn + '::/foo')
        assert isinstance(r.shape, list)
        assert discover(r).shape == (len(df), )
        r.parent.close()
Exemplo n.º 7
0
def test_append_other():
    with tmpfile('.hdf5') as fn:
        x = into(np.ndarray, df)
        dset = into('hdfstore://' + fn + '::/data', x)
        assert discover(dset) == discover(df)
        dset.parent.close()
Exemplo n.º 8
0
def test_append_chunks():
    with file(df) as (fn, f, dset):
        append(dset, chunks(pd.DataFrame)([df, df]))

        assert discover(dset).shape[0] == len(df) * 3
Exemplo n.º 9
0
def test_into_resource():
    with tmpfile('.hdf5') as fn:
        d = into('hdfstore://' + fn + '::/x', df)
        assert discover(d) == discover(df)
        assert eq(into(pd.DataFrame, d), df)
        d.parent.close()
Exemplo n.º 10
0
def test_append():
    with file(df) as (fn, f, dset):
        append(dset, df)
        append(dset, df)
        assert discover(dset).shape == (len(df) * 3, )
Exemplo n.º 11
0
def test_append():
    with file(df) as (fn, f, dset):
        append(dset, df)
        append(dset, df)
        assert discover(dset).shape == (len(df) * 3,)
Exemplo n.º 12
0
def test_append_other():
    with tmpfile(".hdf5") as fn:
        x = into(np.ndarray, df)
        dset = into("hdfstore://" + fn + "::/data", x)
        assert discover(dset) == discover(df)
        dset.parent.close()
Exemplo n.º 13
0
def test_append_other():
    with tmpfile('.hdf5') as fn:
        x = into(np.ndarray, df)
        dset = into('hdfstore://'+fn+'::/data', x)
        assert discover(dset) == discover(df)
        dset.parent.close()
Exemplo n.º 14
0
def test_append_chunks():
    with file(df) as (fn, f, dset):
        append(dset, chunks(pd.DataFrame)([df, df]))

        assert discover(dset).shape[0] == len(df) * 3
Exemplo n.º 15
0
def test_into_resource():
    with tmpfile('.hdf5') as fn:
        d = into('hdfstore://' + fn + '::/x', df)
        assert discover(d) == discover(df)
        assert eq(into(pd.DataFrame, d), df)
        d.parent.close()
Exemplo n.º 16
0
def test_discover():
    with file(df) as (fn, f, dset):
        assert str(discover(dset)) == str(discover(df))
        assert str(discover(f)) == str(discover({'data': df}))
Exemplo n.º 17
0
def test_discover():
    with file(df) as (fn, f, dset):
        assert str(discover(dset)) == str(discover(df))
        assert str(discover(f)) == str(discover({'data': df}))
Exemplo n.º 18
0
def test_into_resource():
    with tmpfile(".hdf5") as fn:
        d = into("hdfstore://" + fn + "::/x", df)
        assert discover(d) == discover(df)
        assert eq(into(pd.DataFrame, d), df)
        d.parent.close()