首页 > 解决方案 > 为什么会出现“IndexError:元组索引超出范围”?

问题描述

为什么我会收到以下代码的以下错误消息:

X_test = []
for i in range(60, 90):
    X_test.append(inputs[i-60:i, 0])
X_test = np.array(X_test)
X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1))

X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1))

IndexError:元组索引超出范围

为什么 for 循环不生成 30*60 矩阵?

标签: pythoncompiler-errorsreshape

解决方案


推荐阅读