Pandas: Count the first consecutive True values : <p>I am trying to implement a function that identifies the <em>first consecutive</em> occurrences in a Pandas <code>Series</code>, which has already been masked with the condition I wanted: (e.g.)</p>

<p><code>[True, True, True, False, True, False, True, True, True, True]</code></p>

<p>I want the above input to give the result of <code>3</code>, i.e., there are 3 <code>True</code> occurrences in a row from the beginning of the series.</p>

<p>I am aware that a big <code>for</code> loop would do the work, but are there any vectorized / Pandas-centric way to go around it?</p>

<p>Thank you very much.</p>
