我有包含 HDF5 数据的 .mat 文件,我想将其加载到 Python (Pandas DataFrame) 中。我可以加载文件:
f2 = h5py.File("file.mat")
f2['data']
这是一个 HDF5 数据集:
<HDF5 dataset "data": shape (9999999, 32), type "<f8">
如果我用 Pandas 阅读它:
g = pd.read_hdf("file.mat",'data')
我收到以下错误:
cannot create a storer if the object is not existing nor a value are passed
如何将其转换为 Pandas DataFrame?
请您参考如下方法:
据我所知,您无法使用未使用 Pandas 编写的 Pandas 方法读取 HDF5 文件。
您可以使用以下方法之一阅读它们:
read matlab v7.3 file into python list of numpy arrays via h5py
Reading ALL variables in a .mat file with python h5py
http://poquitopicante.blogspot.de/2014/05/loading-matlab-mat-file-into-pandas.html
