报错原因:可能是方法后面没有加 ( )
# train_x为dataframe
train_X=train_x.to_numpy
train_X=train_X.reshape((train_X.shape[0],train_X.shape[1],1))
#运行结果
2 train_X=train_x.to_numpy
----> 3 train_X=train_X.reshape(())
AttributeError: 'function' object has no attribute 'reshape'
正确写法:
train_X=train_x.to_numpy()
train_X=train_X.reshape((train_X.shape[0],train_X.shape[1],1))
运行成功
以前不曾注意到的错误,细心啊!细心!