索引器错误:索引0超出大小为0的轴0的界限。我想不出来

2024-05-18 23:40:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下代码:

preds = np.reshape(preds, (preds.shape[0]))
for index in range(0, len(preds)):
    pred = (preds[index]+1)* (X_test[index][0]) #error on this line
    preds_original.append(pred)
preds_original = np.array(preds_original)
if train_phase:
    return [date, y_test, preds_original]
else:
    import datetime
    return [date+datetime.timedelta(days=1),y_test]

但我得到了一个错误:

IndexError: index 0 is out of bounds for axis 0 with size 0

我怎样才能解决这个问题?你知道吗


Tags: 代码intestfordatetimedateindexreturn

热门问题