[Numpy-discussion] array equivalent to string.split(sep)
david.huard at gmail.com
Wed Aug 16 09:16:59 CDT 2006
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])
[[0,1,2,3,4], [6,7,8,9,10,11], [14,15]]
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion