title: Cumsum within group and reset on condition in pandas
body: <p>I have a dataframe with two columns ID and Activity. The activity is either 0 or 1. I want a new column containing a increasing number since the last activity was 1. However, the count should only be within one group (ID). If the activity is 1, the counting column should be reset to 0 and the count starts again. </p>
  
  <p>So, I have a dataframe containing the following:</p>
  
  <p><a href="https://i.stack.imgur.com/ZBSU9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZBSU9.png" alt="enter image description here"></a></p>
  
  <p>What is want is this:</p>
  
  <p><a href="https://i.stack.imgur.com/y5DWF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/y5DWF.png" alt="enter image description here"></a></p>
  
  <p>Can someone help me? </p>