From c6ec11045c9f7864a9193996aab00b90e7bf57f8 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Thu, 30 Jun 2022 15:49:40 +0100 Subject: [PATCH] fix: redundant export of not gzipped pandas Dataframe removed. --- pyerrors/input/pandas.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyerrors/input/pandas.py b/pyerrors/input/pandas.py index 67bd9bbd..caf3e0b6 100644 --- a/pyerrors/input/pandas.py +++ b/pyerrors/input/pandas.py @@ -30,10 +30,12 @@ def dump_df(df, fname, gz=True): if not fname.endswith('.csv'): fname += '.csv' - out.to_csv(fname, index=False) if gz is True: - with open(fname, 'rb') as f_in, gzip.open(fname + ".gz", 'wb') as f_out: - f_out.writelines(f_in) + if not fname.endswith('.gz'): + fname += '.gz' + out.to_csv(fname, index=False, compression='gzip') + else: + out.to_csv(fname, index=False) def load_df(fname, auto_gamma=False, gz=True):