我想你被不同的术语搞糊涂了-熊猫的HDF商店是一个完整的路径,即Group + DataSet_name。。。
演示:In [67]: store = pd.HDFStore(r'D:\temp\.data\hdf\test.h5')
In [68]: store.append('dataset1', df)
In [69]: store.append('/group1/sub_group1/dataset2', df)
In [70]: store.groups
Out[70]:
File path: D:\temp\.data\hdf\test.h5
/dataset1 frame_table (typ->appendable,nrows->9,ncols->2,indexers->[index])
/group1/sub_group1/dataset2 frame_table (typ->appendable,nrows->9,ncols->2,indexers->[index])>
In [71]: store.items
Out[71]:
File path: D:\temp\.data\hdf\test.h5
/dataset1 frame_table (typ->appendable,nrows->9,ncols->2,indexers->[index])
/group1/sub_group1/dataset2 frame_table (typ->appendable,nrows->9,ncols->2,indexers->[index])>
In [72]: store.close()
In [73]: x = pd.read_hdf(r'D:\temp\.data\hdf\test.h5', 'dataset1')
In [74]: x.shape
Out[74]: (9, 2)
In [75]: x = pd.read_hdf(r'D:\temp\.data\hdf\test.h5', '/group1/sub_group1/dataset2')
In [76]: x.shape
Out[76]: (9, 2)