且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ValueError:具有多个元素的数组的真值不明确.使用a.any()或a.all()python

更新时间:2021-11-27 18:02:19

分别对andor尝试&|*+.

Try & and | or * and +, respectively for and and or.

"and"和"or"比较整个对象的整体真实性,但是您需要元素级和的类似物.还有一些numpy函数logical_andlogical_or更明确.

"and" and "or" compares the whole truthiness of the whole object, but you want the analogue of element-wise and. There is are also numpy functions logical_and and logical_or to be more explicit.