[Numpy-discussion] Searching object arrays

Martin Spacek numpy at mspacek.mm.st
Mon May 7 20:25:40 EDT 2007


Great, thanks Tim!

Martin

Timothy Hochberg wrote:
> 
> Using np.equals instead of == seems to work:
> 
>  >>> i = np.array([0,1,2,None,3,4,None])
>  >>> i
> array([0, 1, 2, None, 3, 4, None], dtype=object)
>  >>> np.where(i == None)
> ()
>  >>> i == None
> False
>  >>> np.where(np.equal(i, None))
> (array([3, 6]),)
> 
> I suspect the issue isn't actually object arrays, but rather some 
> optimization related to None, that's causing problems.
> 
> -tim
>  



More information about the NumPy-Discussion mailing list