I want to write a function where if an array is equal to or less than 0 it will replace the values after (and including) that index with 0. The numbers have the 7th element less than 0 being -1, thus elements including the 7th element to 10th element values will be replaced by 0. How could I configure the the np.where function so it gives the expected result values?
Sample input:
numbers = np.array([87., 4., 4.1, 8.5, 10 , 20, 22.3, -1., 1., 60., -4.])
Expected output:
[87., 4., 4.1, 8.5, 10 , 20, 22.3, 0., 0., 0., 0.]