array.shape() giving error tuple not callable(array.shape() 给出错误元组不可调用)
问题描述
我有一个名为 results
的 2D numpy 数组,它包含自己的数据数组,我想进入其中并使用每个列表:
I have a 2D numpy array called results
, which contains its own array of data, and I want to go into it and use each list:
这是我得到的输出:
我不明白为什么 y_pred
不是常规数组以及为什么将其视为元组,我已使用 r
将其分配为数组.
I don't understand why y_pred
is not a regular array and why it's being considered a tuple, I've assigned it to be an array using r
.
推荐答案
shape
只是一个属性,而不是一个方法.只需使用 y_pred.shape
(无括号).
shape
is just an attribute, not a method. Just use y_pred.shape
(no parentheses).
(错误消息不是告诉你 y_pred
是一个元组,而是告诉你 y_pred.shape
是一个元组.)
(The error message isn't telling you that y_pred
is a tuple, it's telling you that y_pred.shape
is a tuple.)
这篇关于array.shape() 给出错误元组不可调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!