title: Pandas time series elapsed time between events
body: <p>I have two time series contained in a dataframe, similar to this :</p>
  <pre><code>events = {'date':['2021-12-31','2021-11-30','2021-10-31','2021-09-30','2021-08-31','2021-07-31','2021-06-30'], 
  'serie_a':[0,0,1,0,0,0,1], 'serie_b':[0,0,0,1,0,1,0]}
   df = pd.DataFrame.from_dict(events)
  
  date        serie_a  serie_b
  2021-12-31        0        0
  2021-11-30        0        0
  2021-10-31        1        0
  2021-09-30        0        1
  2021-08-31        0        0
  2021-07-31        0        1
  2021-06-30        1        0
  </code></pre>
  <p>Series a &amp; b represent the occurence of the same event, but from two different sources. I would like to <strong>quantify the lag between the two sources</strong> (basically to find if one is faster than the other). Now, finding the elapsed time for one series would be easy, but I can't seem to find the trick to compare both.</p>
  <p>I've tried creating a dummy variable which would indicate :</p>
  <pre><code>{100:'No events', 110:'Event in serie_a', 111:'Event in serie a &amp; b', ..}
  
  date        serie_a serie_b  indicator
  2021-12-31        0       0        100
  2021-11-30        0       0        100
  2021-10-31        1       0        110
  2021-09-30        0       1        101
  2021-08-31        0       0        100
  2021-07-31        0       1        101
  2021-06-30        1       0        110
  </code></pre>
  <p>And then create a function which would calculated the elapsed time between indicator = 110 and 101. Is this the right path?</p>
  <ul>
  <li>serie_a or serie_b only contain binary values.</li>
  <li>Events can happen in both series at the same time (indicator = 111).</li>
  <li>Goal would be to have the elapsed time in days.</li>
  <li>Both series are independant - they don't necessarily give out the same number of events.</li>
  </ul>
  <p>Thanks!</p>
  <p>Edit : Added bullet point infos</p>