【发布时间】:2019-09-14 12:35:39
【问题描述】:
我正在尝试将以下内容转换为整数
我有一个变量 p,它在下面
array([0.09641092, 0.02070604, 0.21679783, ..., 0.06453979, 0.02907993, 0.12129478])
我想根据阈值转换数字
thres = 0.5
然后转换
p1 = np.int(p > thres)
但我得到以下错误
TypeError:只有 size-1 的数组可以转换为 Python 标量
【问题讨论】:
标签: python pandas numpy numpy-ndarray