BasicTS icon indicating copy to clipboard operation
BasicTS copied to clipboard

ufunc 'subtract' cannot use operands with types dtype('int64') and dtype('<M8[D]')

Open emanlee opened this issue 1 year ago • 1 comments

您好,我用自己的时序数据, 一列17000行的数据(人数随时间的变化预测),处理数据采用以下代码。 出现了错误:ufunc 'subtract' cannot use operands with types dtype('int64') and dtype('<M8[D]') 请问可能是什么问题,谢谢!

python scripts/data_preparation/mydata/generate_training_data.py

raw time series shape: (17000, 1, 1) number of training samples:11895 number of validation samples:1699 number of test samples:3399 mean (training data): [[[124.47152696]]] std (training data): [[[140.87926682]]] Traceback (most recent call last): File "/home/x/BasicTS-master/scripts/data_preparation/mydata/generate_training_data.py", line 169, in generate_data(args) File "/home/x/BasicTS-master/scripts/data_preparation/mydata/generate_training_data.py", line 73, in generate_data df.index.values - df.index.values.astype("datetime64[D]")) / np.timedelta64(1, "D") numpy.core._exceptions._UFuncBinaryResolutionError: ufunc 'subtract' cannot use operands with types dtype('int64') and dtype('<M8[D]')

emanlee avatar Nov 26 '23 07:11 emanlee

When generating the time in day and day in week features, you need to write code according to the format of your own dataset. It appears that your dataset does not follow the same format as METR-LA/PEMS-BAY. Maybe you can refer to the script of PEMS04.

zezhishao avatar Nov 30 '23 03:11 zezhishao