【发布时间】:2020-10-14 09:18:38
【问题描述】:
使用 numpy 随机函数时出错, 它显示 int 对象不可调用 请提出替代方案
【问题讨论】:
标签: numpy-random
使用 numpy 随机函数时出错, 它显示 int 对象不可调用 请提出替代方案
【问题讨论】:
标签: numpy-random
您在将参数传递给 np.random.random_integers(此处为:(100(3,4))) 时错过了第二个逗号,因此它假定 100 是您传递参数 3 和 4 的函数,但情况并非如此100 是一个整数。
改变
np.random.random_integers(50, 100(3,4))
到
np.random.random_integers(50, 100, (3, 4))
【讨论】:
xx=np.random.random_integers(50,100(3,4))请提出替代方案
作为替代方案,我建议插入缺少的逗号:
xx = np.random.random_integers(50, 100, (3, 4))
【讨论】: