Skip to content

Commit

Permalink
fix dataset for python38 (#2065)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisbader authored Nov 11, 2023
1 parent 09300d9 commit d206055
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 @@ -858,8 +858,8 @@ def pre_process_dataset(dataset_path):
"""Restrict the time axis and add the weather data"""
df = pd.read_csv(dataset_path, index_col=0)
# convert time index
df.index = (
pd.DatetimeIndex(df.index, tz="CET").tz_convert("UTC").tz_localize(None)
df.index = pd.DatetimeIndex(pd.to_datetime(df.index, utc=True)).tz_localize(
None
)
# extract pre-determined period
df = df.loc[
Expand Down Expand Up @@ -914,8 +914,8 @@ def _download_weather_data():
df["param_name"] = df["Parameter"] + " [" + df["Einheit"] + "]"
df = df.pivot(index="Datum", columns="param_name", values="Wert")
# convert time index to from CET to UTC and extract the required time range
df.index = (
pd.DatetimeIndex(df.index, tz="CET").tz_convert("UTC").tz_localize(None)
df.index = pd.DatetimeIndex(pd.to_datetime(df.index, utc=True)).tz_localize(
None
)
df = df.loc[
(pd.Timestamp("2015-01-01") <= df.index)
Expand Down

0 comments on commit d206055

Please sign in to comment.