Skip to content

Commit

Permalink
Replacement of deprecated Series.fillna -> 'method' with ffill() and …
Browse files Browse the repository at this point in the history
…bfill(). (#2442)

Co-authored-by: Dennis Bader <[email protected]>
  • Loading branch information
quant12345 and dennisbader authored Jul 3, 2024
1 parent b95930d commit e246a01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions darts/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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]

Expand Down

0 comments on commit e246a01

Please sign in to comment.