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]