actually working in-memory conversion to hdf5 file
This commit is contained in:
@ -25,10 +25,20 @@ def to_excel_binary(df, **kwargs):
|
||||
res = out.getvalue()
|
||||
return res
|
||||
|
||||
def to_hdf_binary(df, key="df", **kwargs):
|
||||
with BytesIO() as out:
|
||||
df.to_hdf(out, key, **kwargs)
|
||||
res = out.getvalue()
|
||||
|
||||
|
||||
from pandas import HDFStore
|
||||
|
||||
|
||||
def to_hdf_binary(df):
|
||||
with HDFStore(
|
||||
"wontbewritten.h5",
|
||||
mode="a",
|
||||
driver="H5FD_CORE",
|
||||
driver_core_backing_store=0
|
||||
) as out:
|
||||
out["/data"] = df
|
||||
res = out._handle.get_file_image()
|
||||
return res
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user