odo
不支持传播compression
和/或data_columns
ATM。两者都很容易添加,我在这里创建了一个问题
你可以这样做pandas
:
In [1]: df1 = DataFrame({'A' : np.arange(5), 'B' : np.random.randn(5)})
In [2]: df2 = DataFrame({'A' : np.arange(5)+10, 'B' : np.random.randn(5)})
In [3]: df1.to_hdf('test1.h5','df',mode='w',format='table',data_columns=['A'])
In [4]: df2.to_hdf('test2.h5','df',mode='w',format='table',data_columns=['A'])
遍历输入文件。块读/写到最终存储。请注意,您还必须在data_columns
此处指定。
In [7]: for f in ['test1.h5','test2.h5']:
...: for df in pd.read_hdf(f,'df',chunksize=2):
...: df.to_hdf('test3.h5','df',format='table',data_columns=['A'])
...:
In [8]: with pd.HDFStore('test3.h5') as store:
print store
...:
<class 'pandas.io.pytables.HDFStore'>
File path: test3.h5
/df frame_table (typ->appendable,nrows->1,ncols->2,indexers->[index],dc->[A])