[Numpy-discussion] How do I do this?

Alan G Isaac aisaac at american.edu
Fri Aug 29 21:28:58 EDT 2008


>>> Alan G Isaac wrote:
>>>> Does this do what you want? 
>>>> idx = np.abs(a)<min_value 
>>>> a[idx] = min_value 

Christopher Barker wrote:
> -1 should go to -2

ok then:
a[idx] = min_value*np.sign(a[idx])
I think that's what you are saying?

Cheers,
Alan Isaac





More information about the NumPy-Discussion mailing list