title: How do I identify sequences of values in a boolean array?
body: <p>I have a long boolean array:</p>
  
  <pre><code>bool_array = [ True, True, True, True, True, False, False, False, False, False, True, True, True, False, False, True, True, True, True, False, False, False, False, False, False, False ]
  </code></pre>
  
  <p>I need to figure out where the values flips, i.e., the addresses where sequences of <code>True</code> and <code>False</code> begin. In this particular case, I would want to get</p>
  
  <pre><code>index = [0, 5, 10, 13, 15, 19, 26]
  </code></pre>
  
  <p>Is there an easy way to do without manually looping to check every ith element with the (i+1)th?</p>