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

Fabien Lafont lafont.fabien@gmail....
Fri Jan 27 10:56:38 CST 2012


thanks a lot. Is there a way to do so but acting on elements array? I
explain you why. I have a vector with some 'nan' elements. I want to
remove them and to know the position on the array to remove another
element on another array but at the same 'place(position number)'


2012/1/27 Warren Weckesser <warren.weckesser@enthought.com>:
>
>
> 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
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list