>
>
>
> In [1]: a = np.array([0, 2, 4, 1, 3, 0, 3, 4, 0, 1])
>
> In [2]: lim = 2
>
> In [3]: np.sign(a - lim)
> Out[3]: array([-1,  0,  1, -1,  1, -1,  1,  1, -1, -1])
>

Dooh. Facepalm. I should have thought of that myself! Only one intermediate
array needs to be created then. Thank you. That was what I was looking for.

Cheers,
Kim
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to