Re: best cumulative sum



David Isaac wrote:
> What's the good way to produce a cumulative sum?
> E.g., given the list x,
> cumx = x[:]
> for i in range(1,len(x)):
> cumx[i] = cumx[i]+cumx[i-1]
>
> What's the better way?

Define better. More accurate? Less code?

--
Robert Kern
robert.kern@xxxxxxxxx

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

.



Relevant Pages

  • Re: best cumulative sum
    ... Erik Max Francis wrote: ... > Micah Elliott wrote: ... >> On Nov 21, David Isaac wrote: ... >>> What's the good way to produce a cumulative sum? ...
    (comp.lang.python)
  • cumulative sum of field
    ... how can i perform the cumulative sum of a in the field b, in foxpro ... Patrick ... Prev by Date: ...
    (microsoft.public.fox.programmer.exchange)
  • Re: best cumulative sum
    ... Erik Max Francis wrote: ... > Micah Elliott wrote: ... >>On Nov 21, David Isaac wrote: ... The OP asked for a cumulative sum; ...
    (comp.lang.python)
  • Re: cumulative sum of a vector
    ... Jorge Sing wrote: ... > vector that is a cumulative sum of the elements of the first one. ... Prev by Date: ...
    (comp.soft-sys.matlab)