Open ecomodeller opened 3 years ago
>>> from datetime import datetime >>> import pandas as pd >>> from anomalydetection.detectors import DiffRangeDetector >>> >>> dates = [ ... datetime(2000,1,1), ... datetime(2000,1,2), ... datetime(2000,1,7)] >>> >>> normal_data = pd.Series([0.0,0.5,0.0]) >>> normal_data.index = dates >>> >>> df_detector = DiffRangeDetector() >>> >>> df_detector.fit(normal_data) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\jan\code\anomalydetection\anomalydetection\detectors.py", line 155, in fit data_diff = self.diff_time_series(data) File "c:\users\jan\code\anomalydetection\anomalydetection\detectors.py", line 147, in diff_time_series time_diff = data.index.shift() - data.index File "C:\Users\JAN\Miniconda3\lib\site-packages\pandas\core\indexes\datetimelike.py", line 532, in shift result = arr._time_shift(periods, freq=freq) File "C:\Users\JAN\Miniconda3\lib\site-packages\pandas\core\arrays\datetimelike.py", line 1148, in _time_shift raise NullFrequencyError("Cannot shift with no freq") pandas.errors.NullFrequencyError: Cannot shift with no freq