I have a numpy array,
myarray= np.array([49, 7, 44, 27, 13, 35, 171])
i wanted to replace the values if it is greater than 45, so i applied the below code
myarray=np.where(myarray> 45,myarray - 45, myarray)
but this is applied only once in that array, for example, the above array becomes
myarray= np.array([4, 7, 44, 27, 13, 35, 126])
Expected array
myarray= np.array([4, 7, 44, 27, 13, 35, 36])
How do i run the np.where till the condition is satisfied? basically in the above array i dont want any value to be greater than 45, is there a pythonic way of doing it. Thanks in advance.