arr = np.array([2, 4, 3, 7, 6, 1, 9, 4, 6, 5])
sum_arr = arr.cumsum()
Python/numpy: Most efficient way to sum n elements of an array, so that each output element is the sum of the previous n input elements?