diff --git a/.gitignore b/.gitignore index 1dd0855..c6c9f1a 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,9 @@ venv.bak/ .spyderproject .spyproject +# Visual Studio Code project settings +.vscode + # Rope project settings .ropeproject diff --git a/epysurv/models/timeseries/_base.py b/epysurv/models/timeseries/_base.py index a219b0a..4ad552e 100644 --- a/epysurv/models/timeseries/_base.py +++ b/epysurv/models/timeseries/_base.py @@ -21,4 +21,6 @@ def predict(self, data_generator) -> pd.DataFrame: [time] = prediction.index alarms.append(alarm) times.append(time) - return pd.DataFrame({"alarm": alarms}, index=pd.DatetimeIndex(times)) + return pd.DataFrame( + {"alarm": alarms}, index=pd.DatetimeIndex(times, freq="infer") + ) diff --git a/tests/test_simulations.py b/tests/test_simulations.py index 2ed5145..2a88c68 100644 --- a/tests/test_simulations.py +++ b/tests/test_simulations.py @@ -10,12 +10,7 @@ SeasonalNoisePoisson, ) - -def load_simulations(filepath): - simulations = pd.read_csv( - filepath, index_col=0, parse_dates=True, infer_datetime_format=True - ) - return simulations +from .utils import load_simulations @pytest.mark.parametrize( diff --git a/tests/utils.py b/tests/utils.py index 1d519c9..89bebf2 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -5,5 +5,13 @@ def load_predictions(filepath): predictions = pd.read_csv( filepath, index_col=0, parse_dates=True, infer_datetime_format=True ).assign(alarm=lambda df: df["alarm"].astype(bool)) + freq = pd.infer_freq(predictions.index) + return predictions.asfreq(freq) - return predictions + +def load_simulations(filepath): + simulations = pd.read_csv( + filepath, index_col=0, parse_dates=True, infer_datetime_format=True + ) + freq = pd.infer_freq(simulations.index) + return simulations.asfreq(freq)