matlab制作h5数据集,python - ValueError:HDF5文件中没有来自MatLab h5文件的pandas.read_hdf的数据集 - 堆栈内存溢出...

我得到一个ValueError: No dataset in HDF5 file. 使用时:

In [1]: import pandas as pda

In [2]: store = pda.read_hdf('X.h5')

---------------------------------------------------------------------------

ValueError Traceback (most recent call last)

in ()

----> 1 store = pda.read_hdf('X.h5')

/usr/local/miniconda3/envs/tensorFlow-GPU/lib/python3.6/site-packages/pandas/io/pytables.py in read_hdf(path_or_buf, key, mode, **kwargs)

356 groups = store.groups()

357 if len(groups) == 0:

--> 358 raise ValueError('No dataset in HDF5 file.')

359 candidate_only_group = groups[0]

360

ValueError: No dataset in HDF5 file.

h5dump显示:

$ h5dump -n X.h5

HDF5 "X.h5" {

FILE_CONTENTS {

group /

dataset /DS

}

}

如果我使用h5py我可以看到数据:

In [3]: import h5py

/usr/local/miniconda3/envs/tensorFlow-GPU/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

from ._conv import register_converters as _register_converters

In [4]: f = h5py.File('X.h5','r')

In [5]: f.keys()

Out[5]: KeysView()

In [6]: list( f.keys() )

Out[6]: ['DS']

In [7]: f['DS']

Out[7]:

In [8]: f['DS'][:]

Out[8]:

array([[1., 0., 1., 1., 0., 0., 1., 1., 1., 1., 0., 1., 0., 0., 0., 1.,

0., 1., 0., 0.],

[0., 0., 0., 1., 0., 1., 1., 0., 1., 0., 1., 1., 1., 1., 0., 0.,

1., 1., 0., 0.],

[0., 1., 1., 1., 1., 0., 1., 1., 1., 0., 1., 0., 1., 1., 0., 0.,

1., 1., 0., 0.],

[0., 0., 1., 1., 1., 1., 1., 1., 1., 0., 0., 1., 1., 1., 1., 1.,

1., 0., 1., 0.],

[0., 1., 1., 1., 0., 1., 1., 1., 1., 1., 1., 0., 1., 1., 0., 1.,

0., 1., 0., 0.],

[0., 0., 1., 1., 1., 1., 0., 1., 1., 1., 0., 1., 1., 0., 1., 1.,

1., 1., 0., 0.],

[0., 0., 0., 0., 1., 1., 1., 1., 1., 1., 0., 0., 1., 1., 0., 1.,

1., 1., 0., 1.],

[0., 0., 1., 1., 1., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0.,

0., 1., 0., 1.],

[0., 0., 0., 1., 1., 1., 1., 1., 0., 0., 0., 0., 1., 1., 1., 0.,

1., 0., 0., 0.],

[0., 1., 0., 1., 1., 1., 1., 1., 1., 0., 0., 1., 1., 1., 0., 1.,

1., 0., 0., 0.]])

你可能感兴趣的:(matlab制作h5数据集)