如果列表或數組包含字符串的numpy.equal功能不起作用:numpy.equal字符串值
>>> import numpy
>>> index = numpy.equal([1,2,'a'],None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function not supported for these types, and can't coerce safely to supported types
什麼是解決此不通過每個元素循環的最簡單的方法?最後,我需要index
包含一個布爾數組,指示哪些元素是None
。