title: Identifying consecutive occurrences of a value in a column of a pandas DataFrame
body: <p>I have a df like so:</p>
  
  <pre><code>Count
  1
  0
  1
  1
  0
  0
  1
  1
  1
  0
  </code></pre>
  
  <p>and I want to return a <code>1</code> in a new column if there are two or more consecutive occurrences of <code>1</code> in <code>Count</code> and a <code>0</code> if there is not. So in the new column each row would get a <code>1</code> based on this criteria being met in the column <code>Count</code>.  My desired output would then be:</p>
  
  <pre><code>Count  New_Value
  1      0 
  0      0
  1      1
  1      1
  0      0
  0      0
  1      1
  1      1 
  1      1
  0      0
  </code></pre>
  
  <p>I am thinking I may need to use <code>itertools</code> but I have been reading about it and haven't come across what I need yet. I would like to be able to use this method to count any number of consecutive occurrences, not just 2 as well.  For example, sometimes I need to count 10 consecutive occurrences, I just use 2 in the example here.</p>