Hello - I am wondering what the better way is to select part of an
array.

Say I have an array a:

a = arange(10)

Now I want to select the values larger than 5

a[ a>5 ]

and later I need the values smaller or equal to 5

a[ a<=5 ]

It seems that doing the comparison twice is extra work (especially if
the array is large).

So I thought I store the comparison

b = a>5

Now I can do

a[b]

But how do I get the others?

a[not b] or a[!b] don't work. So it's gotta be something different.

Besides, is it a good idea to store b like I suggest?

Thanks for the help,

Mark

_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to