I am trying to do an operation relative to the location of the element during an elementwise numpy operation. I cannot figure out how access the current location in order to sum it with the next three elements. I have included a sample array as well as a sample solution I am trying to achieve. Since the real array is over 1MM rows a for loop would be too slow. Thank you!
import numpy as np
k = np.random.rand(10,1)*10
k.astype(int)