From e246a01bade800e4898c183e3017352eedf48b56 Mon Sep 17 00:00:00 2001 From: Kamil <32775019+quant12345@users.noreply.github.com> Date: Wed, 3 Jul 2024 16:20:24 +0500 Subject: [PATCH] Replacement of deprecated Series.fillna -> 'method' with ffill() and bfill(). (#2442) Co-authored-by: Dennis Bader --- darts/datasets/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/darts/datasets/__init__.py b/darts/datasets/__init__.py index 57d6f55957..d4393e8f29 100644 --- a/darts/datasets/__init__.py +++ b/darts/datasets/__init__.py @@ -572,8 +572,8 @@ def _to_multi_series(self, series: pd.DataFrame) -> List[TimeSeries]: # filter column down to the period of recording srs = srs.replace(0.0, np.nan) - start_date = min(srs.fillna(method="ffill").dropna().index) - end_date = max(srs.fillna(method="bfill").dropna().index) + start_date = min(srs.ffill().dropna().index) + end_date = max(srs.bfill().dropna().index) active_range = (srs.index >= start_date) & (srs.index <= end_date) srs = srs[active_range].fillna(0.0) @@ -670,8 +670,8 @@ def _to_multi_series(self, series: pd.DataFrame) -> List[TimeSeries]: srs = series[label] # filter column down to the period of recording - start_date = min(srs.fillna(method="ffill").dropna().index) - end_date = max(srs.fillna(method="bfill").dropna().index) + start_date = min(srs.ffill().dropna().index) + end_date = max(srs.bfill().dropna().index) active_range = (srs.index >= start_date) & (srs.index <= end_date) srs = srs[active_range]