解决方法
报错全称为:ValueError: data must be a 2 column data.frame, with thefirst column being a set of timestamps, and the second coloumn being numeric values.
这是因为数据格式错了,正确的数据格式应该是:一列是时间格式(datetime格式),一列是值
报错原因
类似下面的这个demo
from pyculiarity import detect_ts
import pandas as pd
import numpy as np
data = pd.DataFrame(data={
'time': pd.date_range('2020-01-01', periods=100, freq='D'),
'data': np.random.randint(0, 20, 100),
})
results = detect_ts(data, max_anoms=0.02, direction='both', only_last='day')