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()
|
res = out.getvalue()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def to_hdf_binary(df, key="df", **kwargs):
|
|
||||||
with BytesIO() as out:
|
|
||||||
df.to_hdf(out, key, **kwargs)
|
from pandas import HDFStore
|
||||||
res = out.getvalue()
|
|
||||||
|
|
||||||
|
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
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user