[SciPy-user] indices of consecutive elements

Daniel Ashbrook anjiro@cc.gatech....
Tue Dec 2 13:12:31 CST 2008


Aaah, so much better! I'm still getting used to how arrays operate
differently than python lists. That's really cool - thanks a lot! This
will make my work so much easier.


dan


Pierre GM wrote:
> There's simpler:
>  >>> [(_.start,_.stop-1) for _ in  c.slices[(c.sizes>=4) &  
> (c.uniques==1)]]
> 
> as c.slices is an array, you can directly select its elements that  
> satisfy some conditions: here, we take the clusters that cover at  
> least 4 element, provided the unique element is 1...



More information about the SciPy-user mailing list