[Numpy-discussion] Simple problem. Is it possible without a loop?

Francesc Alted faltet@pytables....
Wed Jun 9 03:19:13 CDT 2010


A Wednesday 09 June 2010 10:14:22 V. Armando Solé escrigué:
> That was my first thought, but that only warrants me to skip one point
> in x but not more than one.
> 
>  >>> x= numpy.arange(10.)
>  >>> delta = 3
>  >>> print x[(x[1:] - x[:-1]) >= delta]
> 
> []
> 
> instead of the requested [0, 4, 8]

True!  Wanting to be fast always makes you ending with the wrong result :-/

-- 
Francesc Alted


More information about the NumPy-Discussion mailing list