title: Pandas dataframe - running sum with reset
body: <p>I want to calculate the running sum in a given column(without using loops, of course). The caveat is that I have this other column that specifies when to reset the running sum to the value present in that row. Best explained by the following example:</p>
  
  <pre><code>   reset  val   desired_col
  0      0    1   1
  1      0    5   6
  2      0    4   10
  3      1    2   2
  4      1   -1   -1
  5      0    6   5
  6      0    4   9
  7      1    2   2
  </code></pre>
  
  <p><code>desired_col</code> is the value I want to be calculated.</p>