Hi,

I have a time series that I want to split into contiguous groups differentiated by a condition. I didn't find a vectorized way to that, so I ended up doing a for loop...

I know there are split functions that split arrays into equal lengths subarrays, but is there a swell trick to return a sequence of arrays separated by a condition ?

For instance, I would like to do something like:

>>> a = array([1,1,1,1,1,5,1,1,1,1,1,1,6,2,1,1])
>>> a.argsplit(a>1)
[[0,1,2,3,4], [6,7,8,9,10,11], [14,15]]

Thanks,

David
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to