[Numpy-discussion] summing an array

Chris Withers chris@simplistix.co...
Thu Aug 18 09:19:06 CDT 2011


Hi All,

Hopefully a simple newbie question, if I have an array such as :

array([0, 1, 2, 3, 4])

...what's the best way to cummulatively sum it so that I end up with:

array([0, 1, 3, 6, 10])

How would I do this both in-place and to create a new array?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk


More information about the NumPy-Discussion mailing list