我正在尝试将 .mat 文件中的数据加载到 python 中,以便可以将其保存在 HDF5 文件中。
问题是scipy.io.loadmat
返回一个包含 dtype=[('counts', '|O4')]) 数组的字典
每当我尝试使用返回的数组之一创建数据集时,都会收到以下错误:
>> mat = scipy.io.loadmat('state-10.mat')
>> h = h5py.File('test.hdf5','w')
>> h.create_dataset('set', data=mat['ProteinComplex'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/h5py/_hl/group.py", line 69, in create_dataset
dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
File "/usr/lib/python2.7/dist-packages/h5py/_hl/dataset.py", line 88, in make_new_dset
tid = h5t.py_create(dtype, logical=1)
File "h5t.pyx", line 1332, in h5py.h5t.py_create (h5py/h5t.c:11600)
File "h5t.pyx", line 1373, in h5py.h5t.py_create (h5py/h5t.c:11209)
File "h5t.pyx", line 1311, in h5py.h5t._c_compound (h5py/h5t.c:10695)
File "h5t.pyx", line 1332, in h5py.h5t.py_create (h5py/h5t.c:11600)
File "h5t.pyx", line 1402, in h5py.h5t.py_create (h5py/h5t.c:11465)
TypeError: Object dtype dtype('object') has no native HDF5 equivalent
有什么解决方法吗?