[Numpy-discussion] looking for the Numpy to do it

Mathew Yeates myeates at jpl.nasa.gov
Tue Jul 11 16:49:15 EDT 2006


I can handle the following problem by iterating through some indices but 
I'm looking for a more elegant solution.

If I have a 1d array, I want to find a contiguous nonzero region about a 
given index. For example, if a=[1,2,3,0,40,50,60,0,7,8,9] and we start 
with the index of 5, then I want the indices 4,5,6

Any gurus out there?

Mathew





More information about the NumPy-Discussion mailing list