How can I tell whether a numpy boolean array contains only a single block
of `True`s?
If I have a numpy array containing booleans, say the output of some math
comparison, what's the best way of determining whether that array contains
only a single contiguous block of Trues, e.g.
array([False, False, False, True, True, True, False, False, False],
dtype=bool)
i.e. where the sequence ...,True, False, ..., True... never occurs?
No comments:
Post a Comment