actually working in-memory conversion to hdf5 file

This commit is contained in:
2022-05-23 12:42:22 +02:00
parent 24ebaf417b
commit 48c163f9d7

View File

@ -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