From 1e24aa9bc76460d72918c2e9d4af7cab1da3170b Mon Sep 17 00:00:00 2001 From: Michael Currin <18750745+MichaelCurrin@users.noreply.github.com> Date: Sat, 26 Feb 2022 10:52:55 +0200 Subject: [PATCH] fix: remove verify_integrity flag in fit_model.py --- dayliopy/fit_model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dayliopy/fit_model.py b/dayliopy/fit_model.py index 146cd67..6cec53e 100755 --- a/dayliopy/fit_model.py +++ b/dayliopy/fit_model.py @@ -41,6 +41,13 @@ def prepare_data(df: pd.DataFrame) -> pd.DataFrame: year. Therefore for simplicity, unique year values are split into one-hot encoded columns, as with week and month. + e.g. weekday_1, weekday_7, month_1, month_12 + + We no longer set `verify_integrity=False` on the datetime index, as this + causes errors in the unlikely case that someone sets two records for the + same time. Which is okay as we only use the index for month and year. + See issue #25. + :param df: Cleaned input data. :return df: Encoded data. @@ -50,7 +57,7 @@ def prepare_data(df: pd.DataFrame) -> pd.DataFrame: df["datetime"] = pd.to_datetime(df.datetime) - df.set_index("datetime", inplace=True, verify_integrity=True) + df.set_index("datetime", inplace=True) df["month_num"] = df.index.month df["year"] = df.index.year