diff --git a/nowcast/workers/collect_river_data.py b/nowcast/workers/collect_river_data.py index 68b5d9d6..d8182cb5 100644 --- a/nowcast/workers/collect_river_data.py +++ b/nowcast/workers/collect_river_data.py @@ -128,7 +128,7 @@ def _calc_eccc_day_avg_discharge(river_name, data_date, config): csv_file, usecols=["Date", "Discharge / Débit (cms)"], index_col="Date", - date_parser=lambda x: pandas.to_datetime(x.rpartition("-")[0]), + date_format="ISO8601", ) day_avg_discharge = df.loc[f"{data_date.format('YYYY-MM-DD')}"].mean()[ "Discharge / Débit (cms)" diff --git a/tests/workers/test_collect_river_data.py b/tests/workers/test_collect_river_data.py index 7bfdd510..5ce066bb 100644 --- a/tests/workers/test_collect_river_data.py +++ b/tests/workers/test_collect_river_data.py @@ -284,7 +284,7 @@ class TestCalcECCC_DayAvgDischarge: """Unit test for _calc_eccc_day_avg_discharge() function.""" def test_calc_eccc_day_avg_discharge(self, config, caplog, tmp_path, monkeypatch): - def mock_read_csv(csv_file, usecols, index_col, date_parser): + def mock_read_csv(csv_file, usecols, index_col, date_format): return pandas.DataFrame( numpy.linspace(41.9, 44.1, 290), index=pandas.date_range(