title: Aggregate row values in Dataframe under specific condition
body: <p>I have a <code>dataframe</code> which has two columns. I want to build the sum of all successive rows where value of <code>column 0</code> is <code>-1</code>.</p>
  
  <p>My <code>dataframe</code> looks sth. like this:</p>
  
  <pre><code> 0   2
   1   3
  -1   4
  -1   7
   0   2
  -1   0
  -1   1
  -1   3
   5   0
  </code></pre>
  
  <p>And the desired output should be this:</p>
  
  <pre><code> 0   2
   1   3
  -1   11
   0   2
  -1   4
   5   0
  </code></pre>
  
  <p>the values in the second column are all equal or greater than zero. The values on first column are equal or greater than <code>-1</code>, if this helps. My approach would be a loop, where I create second <code>dataframe</code> and then push back every value not equal to <code>-1</code> and accumulate, when I found a <code>-1</code>, but I imagine, this approach would not be efficient. 
  Pseudo code:</p>
  
  <pre><code>sum = 0
  found = False
  for row in dataframe:
     if row[0] != -1:
         if found:
             new_df.append([-1, sum])
             sum = 0
             found = False
         new_df.append(row)
     elif row[0] == -1:
         found = True
         sum += row[1]
  </code></pre>
  
  <p>Is there a build-in python or pandas function I can use to achive my goal?</p>