I have a numpy array that may contain inf values. The numpy array is a 1D vector of numbers. Is there a way to change the inf values of the array for the previous value of the array (which is not inf)? So if the 1000th index of the array is an inf it should replace it by the 999th