[Numpy-discussion] Simple problem. Is it possible without a loop?
Vicente Sole
sole@esrf...
Wed Jun 9 10:47:59 CDT 2010
Quoting josef.pktd@gmail.com:
> but the two options don't produce the same result in general, the
> cumsum version doesn't restart from zero, I think
>
> try
> x0 = np.random.randint(5,size=30).cumsum()
> with delta=3
>
> I don't see a way around recursive looping
>
The x0 data are already sorted. It was one of the premises of the first post.
The solution I proposed makes "almost" what I need and I will most
likely use it. It just misses the first value but takes the next one
what is fine for my application. For the simple example, it returns
[1, 5, 9] instead of [0, 4, 8] but it should not disturb me.
Armando
More information about the NumPy-Discussion
mailing list