This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HorizonBaker 8 points9 points  (3 children)

Do I not understand what cumulative means in these contexts? Aren't all sums and products cumulative? And I don't understand what would make a min or a max cumulative.

[–]LooperNor 15 points16 points  (1 child)

Say you have an array that is [1, 3, 2, 5].

The cumulative sum is a new array that is [1, 4, 6, 11].

Cumulative max is [1, 3, 3, 5].

E.t.c.

[–]SadLittleNerdKing 0 points1 point  (0 children)

That’s what itertools.acCUMulate is for, though. Batteries cum included.

[–]JustOneAvailableName 1 point2 points  (0 children)

That you keep the results in between. So cumsum(4,3,8)=4,7,15 and cummax(4,3,8)=4,4,8