def append_data_frame(fn, df):
''' Write the pandas dataframe object to an HDF5 file. Each column is written as a single 1D dataset at the top
level of the HDF5 file, using the native pandas datatype'''
if not os.path.exists(fn):
write_data_frame(fn, df)
return
f = h5py.File(fn, "a")
column_names = f.attrs.get("column_names")
for col_name in column_names:
ds = f[col_name]
col = df[col_name]
append_data_column(ds, col)
f.close()
评论列表
文章目录