[Numpy-discussion] How do I do this?

Alan G Isaac aisaac@american....
Sat Aug 30 08:24:27 CDT 2008


Stéfan van der Walt wrote:
> (np.sign(a) | 1) ...

Ah, that's nice. How about
idx = np.abs(a)<min_value
a[idx] = min_value*(np.sign(a[idx]) | 1)

Alan



More information about the Numpy-discussion mailing list