[Numpy-discussion] Want cumsum-like function
Wed Feb 24 23:03:27 CST 2010
On 02/24/2010 09:00 PM, Robert Kern wrote:
> On Wed, Feb 24, 2010 at 22:53, Peter Shinners<email@example.com> wrote:
>> I want a function that works like cumsum, but starts at zero, instead of
>> starting with the first actual value.
>> For example; I have an array with [4,3,3,1].
>> Cumsum will give me an array with [4,7,10,11].
>> I want an array that is like [0,4,7,8].
> I don't understand what process would give you [0, 4, 7, 8] rather
> than [0, 4, 7, 10]. Can you explain a bit more?
Just brain failure. Yes, [0,4,7,10] is the desired result.
More information about the NumPy-Discussion