title: Consecutive values in pandas column
body: <p>I have pandas <code>df['realize']</code></p>
  
  <pre><code>time                      realize
  2016-01-18 08:25:00     -46.369083
  2016-01-19 14:30:00     -819.010738
  2016-01-20 11:10:00    -424.955847
  2016-01-21 07:15:00     27.523859
  2016-01-21 16:10:00     898.522762
  2016-01-25 00:00:00    761.063545
  </code></pre>
  
  <p>Where <code>time</code> is:</p>
  
  <pre><code>df.index = df['time']
  df.index = pd.to_datetime(df.index)
  </code></pre>
  
  <p>Where <code>df['realize']</code> is:</p>
  
  <pre><code>In: type(df['realize'])
  Out: pandas.core.series.Series
  </code></pre>
  
  <p>I want to count consecutive values, rule is simple (<code>df['realize'] &gt; 0, df['realize'] &lt; 0</code>)</p>
  
  <p>Expected out:</p>
  
  <pre><code>time                      realize    Consecutive
  2016-01-18 08:25:00     -46.369083    1
  2016-01-19 14:30:00     -819.010738   2
  2016-01-20 11:10:00    -424.955847    3
  2016-01-21 07:15:00     27.523859     1
  2016-01-21 16:10:00     898.522762    2
  2016-01-25 00:00:00    761.063545     3
  </code></pre>
  
  <p>I read about topics about loop, but didn't find what I need. Thanks in advance for help.</p>