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

Vicente Sole sole@esrf...
Wed Jun 9 10:08:39 CDT 2010


Correct. I thought just multiplying by -1 and inverting the logical  
condition would give me the same output.

This makes exactly what I want:

>>> x= numpy.arange(10.)
>>> delta=3
>>> y=[x[0]]
>>> for value in x:
> ...     if (value-y[-1]) < delta:
> ...        y.append(value)
> ...
>>> y
[0., 4., 8.]


Armando



More information about the NumPy-Discussion mailing list