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

Fabien Lafont lafont.fabien at gmail.com
Fri Jan 27 11:56:38 EST 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 at enthought.com>:
>
>
> On Fri, Jan 27, 2012 at 10:49 AM, Fabien Lafont <lafont.fabien at 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 at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list