From ca5119a023cf0633a35adb19141c001cd411bfea Mon Sep 17 00:00:00 2001 From: hanne-opseth-rygg-4ss <142307980+hanne-opseth-rygg-4ss@users.noreply.github.com> Date: Mon, 5 Feb 2024 10:38:44 +0100 Subject: [PATCH] try except on deprecated functionality --- fourinsight/engineroom/utils/_core.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/fourinsight/engineroom/utils/_core.py b/fourinsight/engineroom/utils/_core.py index ca915bd4..670f9877 100644 --- a/fourinsight/engineroom/utils/_core.py +++ b/fourinsight/engineroom/utils/_core.py @@ -457,14 +457,21 @@ def pull(self, raise_on_missing=True, strict=True): return self._handler.seek(0) - df_source = pd.read_csv( - self._handler, - index_col=0, - parse_dates=True, - dtype=self._headers, - date_format="ISO8601", - ) - + try: + df_source = pd.read_csv( + self._handler, + index_col=0, + parse_dates=True, + dtype=self._headers, + date_format="ISO8601", + ) + except TypeError: # for backward compatibility (remove after 2024-06-01) + df_source = pd.read_csv( + self._handler, + index_col=0, + parse_dates=True, + dtype=self._headers, + ) if strict and set(df_source.columns) != set(self._headers.keys()): raise ValueError("Header is not valid.")