numpy 转 bool?

numpy 转 bool?

 bool(np.arange(0,10))

# Traceback (most recent call last):

# File "<stdin>", line 1, in <module>

# ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

我想让这个为真怎么做


回答:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

np.arange(0,10).any()

以上是 numpy 转 bool? 的全部内容, 来源链接: utcz.com/p/938630.html

回到顶部