title: How to find the alignment of two data sets in pandas
body: <p>Presented as an example.</p>
  
  <p>Two data sets. One collected over a 1 hour period. One collected over a 20 min period within that hour.</p>
  
  <p>Each data set contains instances of events that can transformed into single columns of true (<code>-</code>) or false (<code>_</code>), representing if the event is occurring or not.</p>
  
  <p>DS1.event:</p>
  
  <pre><code>_-__-_--___----_-__--_-__---__
  </code></pre>
  
  <p>DS2.event:</p>
  
  <pre><code>__--_-__--
  </code></pre>
  
  <p>I'm looking for a way to automate the correlation (correct me if the terminology is incorrect) of the two data sets and find the offset(s) into DS1 at which DS2 is most (top x many) likely to have occurred. This will probably end up with some matching percentage that I can then threshold to determine the validity of the match.</p>
  
  <p>Such that</p>
  
  <pre><code>_-__-_--___----_-__--_-__---__
                   __--_-__--
  </code></pre>
  
  <p>DS1.start + 34min ~= DS2.start</p>
  
  <p>Additional information:<br>
  DS1 was recorded at roughly 1 Hz. DS2 at roughly 30 Hz. This makes it less likely that there will be a 100% clean match.</p>
  
  <p>Alternate methods (to pandas) will be appreciated, but python/pandas are what I have at my disposal.</p>