Is there a simple way of replacing all negative values in an array with 0?
I'm having a complete block on how to do it using a NumPy array.
E.g.
a = array([1, 2, 3, -4, 5])
I need to return
[1, 2, 3, 0, 5]
a < 0
gives:
[False, False, False, True, False]
This is where I'm stuck - how to use this array to modify the original array.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…