reduceat
array = np.arange(10)
indices = np.array([1,3,4,5])
output = numpy.add.reduceat(array,indices)
print(output)
Homeless Heron
array = np.arange(10)
indices = np.array([1,3,4,5])
output = numpy.add.reduceat(array,indices)
print(output)
print("Step1 : ", np.add.reduce(array[1:3]))
print("Step2 : ", np.add.reduce(array[3:4]))
print("Step3 : ", np.add.reduce(array[4:5]))
print("Step4 : ", np.add.reduce(array[5:]))