I have a numpy array like
x=np.array([1,2,3,4])
I want to create another numpy array y which is the cumulative sum of x, so that
Another option is:
y = np.add.accumulate(x)
which is often times faster than np.cumsum even though the documentation says they are equivalent.
np.cumsum
y = np.cumsum(x)
See http://docs.scipy.org/doc/numpy/reference/generated/numpy.cumsum.html