[Numpy-discussion] Is there a way to reset an accumulate function?

Frédéric Bastien nouiz at nouiz.org
Tue Oct 23 13:19:27 EDT 2012


Hi,

Why not start conting from the end of the vector until you find a nan?
Your problem do not need to check the full vector.

Fred

On Tue, Oct 23, 2012 at 1:11 PM, Cera, Tim <tim at cerazone.net> wrote:
> I have an array that is peppered throughout in random spots with 'nan'.  I
> would like to use 'cumsum', but I want it to reset the accumulation to 0
> whenever a 'nan' is encountered.  Is there a way to do this?  Aside from a
> loop - which is what I am going to setup here in a moment.
>
> Kindest regards,
> Tim
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list