[Numpy-discussion] Masking an array with another array

Gökhan SEVER gokhansever@gmail....
Wed Apr 22 16:21:05 CDT 2009


Hello,

Could you please give me some hints about how to mask an array using another
arrays like in the following example.

In [14]: a = arange(5)

In [15]: a
Out[15]: array([0, 1, 2, 3, 4])

and my secondary array is "b"

In [16]: b = array([2,3])

What I want to do is to mask a with b values and get an array of:

array([False, False, True, True,  False], dtype=bool)

That is just an manually created array. I still don't know how to do this
programmatically in Pythonic fashion or numpy's masked array functions.

Thank you.


Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090422/c0632fe4/attachment.html 


More information about the Numpy-discussion mailing list