title: Pandas: count gaps for specific values
body: <p>I want to count how many times values are not listed in a data frame.</p>
  
  <pre><code>1 A
  2 A
  3 B
  4 A
  5 C
  6 B
  7 C
  8 A
  9 B
  </code></pre>
  
  <p>For <code>A</code> that would mean: </p>
  
  <p>1-2: 0 times</p>
  
  <p>2-4: 1 times</p>
  
  <p>4-8: 3 times</p>
  
  <p>For <code>B</code> that would mean: </p>
  
  <p>3-6: 2 times</p>
  
  <p>6-9: 2 times</p>
  
  <p>For <code>C</code> that would mean: </p>
  
  <p>5-7: 1 times</p>
  
  <p>Is there a clever way to do this with pandas?
  The Indexes are actually timestamps, but I think this is not important to the problem.</p>