30 Aug
2008
30 Aug
'08
2:39 p.m.
On Sat, Aug 30, 2008 at 7:29 AM, Keith Goodman
On Sat, Aug 30, 2008 at 6:24 AM, Alan G Isaac
wrote: Stéfan van der Walt wrote:
(np.sign(a) | 1) ...
Ah, that's nice. How about idx = np.abs(a)
Or, since he asked to do it in one line,
min_value = 2 x array([ 1, 2, -5, -1, 0]) np.sign(x | 1) * np.maximum(np.abs(x), min_value) array([ 2, 2, -5, -2, 2])
Why did I send that? Sorry. I saw Stéfan's (np.sign(a) | 1), plugged it in and sent it. But Stéfan already did that. An automated 5 minute delay on sending numpy email would cut the email you get from me in half.