[Numpy-discussion] (no subject)

Robert Kern robert.kern at gmail.com
Fri Nov 22 16:40:23 EST 2013


On Fri, Nov 22, 2013 at 9:23 PM, Matthew Brett <matthew.brett at gmail.com>
wrote:
>
> Hi,
>
> I'm sorry if I missed something obvious - but is there a vectorized
> way to look for None in an array?
>
> In [3]: a = np.array([1, 1])
>
> In [4]: a == object()
> Out[4]: array([False, False], dtype=bool)
>
> In [6]: a == None
> Out[6]: False

[~]
|1> x = np.array([1, None, 2], dtype=object)

[~]
|2> np.equal(x, None)
array([False,  True, False], dtype=bool)

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20131122/1eb5484f/attachment.html>


More information about the NumPy-Discussion mailing list