From fa0ae6af03aee652cbbb1603cb113bf410348c97 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sun, 22 May 2022 19:43:38 +0200 Subject: [PATCH] added in-memory conversion to hdf5 file; allowed kwargs for excel conversion --- utils/df_utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/utils/df_utils.py b/utils/df_utils.py index c5d2c45..d256b04 100644 --- a/utils/df_utils.py +++ b/utils/df_utils.py @@ -19,9 +19,15 @@ class DateFrameHolder: from io import BytesIO -def to_excel_binary(df): +def to_excel_binary(df, **kwargs): with BytesIO() as out: - df.to_excel(out) + df.to_excel(out, **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() return res