[SciPy-User] [scipy-user] How to remove a value from an np array?

Warren Weckesser warren.weckesser@enthought....
Fri Jan 27 10:52:23 CST 2012


On Fri, Jan 27, 2012 at 10:49 AM, Fabien Lafont <lafont.fabien@gmail.com>wrote:

> I have that [3,2,4,8,7,8,9] and I want [3,2,8,7,8] how can I do?  I've
> tried remove() but it works only on lists not on np.array.
>


In [21]: a = array([3,2,4,8,7,8,9])

In [22]: b = a[(a != 4) & (a != 9)]

In [23]: b
Out[23]: array([3, 2, 8, 7, 8])


Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120127/223e9273/attachment.html 


More information about the SciPy-User mailing list