失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or

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

时间:2019-02-01 23:22:17

相关推荐

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

今天python提示这样一个错误:

#数据是这样来的# features = np.asarray(features_array)# 出错语句:if (features == None):returnValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

这意思就是说,如果是数组,不能这样判断。需要a.all()判断。

如果是None,那么怎么办?所以吾干脆加了个初始化标志来处理这个问题。

......InitedFlag=FalseInitedFlag=Trueif (InitedFlag == False):return

如果觉得《ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。