A= array([1, 2, 3, 4, 2, 3, 0, 1, 5, 3, 1, 0])
In this array I want to add the values of first three arrays in list i.e., 1+2+3 = 6
Then I want to add the next three values i.e 4+2+3 = 9 and so on.
How to perform this array addition without loops?
You can subtract the first sums from the second and subsequent sums by taking a linear subset of the cumulative sum:
Output: