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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #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
Example #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()
Example #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, )
Example #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,)
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()
Example #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()
Example #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
Example #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()
Example #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}))
Example #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}))
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()