【问题标题】:error while using Numpy Random function (np.random.random_integers)使用 Numpy Random 函数时出错(np.random.random_integers)
【发布时间】:2020-10-14 09:18:38
【问题描述】:

enter image description here

使用 numpy 随机函数时出错, 它显示 int 对象不可调用 请提出替代方案

【问题讨论】:

    标签: numpy-random


    【解决方案1】:

    您在将参数传递给 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))
    

    【讨论】:

    • 感谢 Shreya ????
    【解决方案2】:
    xx=np.random.random_integers(50,100(3,4))
    

    请提出替代方案

    作为替代方案,我建议插入缺少的逗号:

    xx = np.random.random_integers(50, 100, (3, 4))
    

    【讨论】:

    • 感谢拉迈??
    猜你喜欢
    • 1970-01-01
    • 2017-11-22
    • 1970-01-01
    • 2017-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多