Skip to content

Commit

Permalink
try except on deprecated functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
hanne-opseth-rygg-4ss committed Feb 5, 2024
1 parent 555bf89 commit ca5119a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions fourinsight/engineroom/utils/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down

0 comments on commit ca5119a

Please sign in to comment.