title: List comprehension with pandas datetime index
body: <p>I'm looking for 6 hour gaps in a pandas dataframe using the datetime index and I want to create a list with the datetime object just after the gap using a list comprehension something like this:</p>
  
  <pre><code>starttimes = [x for i, x in enumerate(data.index) if ((x - x[i-1]).seconds/3600.0) &gt; 6 ]
  </code></pre>
  
  <p>but I get the following type error:</p>
  
  <pre><code>TypeError: 'Timestamp' object does not support indexing
  </code></pre>
  
  <p>The error occurs after the enumerate(data.index), but I am not sure why I am getting this error because I can do:</p>
  
  <pre><code>(data.index[0] - data.index[1]).seconds/3600.0 &gt; 6
  </code></pre>
  
  <p>just fine and the output is true.</p>
  
  <p>I also tried this way and got a different type error:</p>
  
  <pre><code>starttime = [x for i, x in enumerate(WaterTest) if ((x.index - x.index[i-1]).seconds/3600.0) &gt; 6 ]
  
  TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
  </code></pre>
  
  <p>Is there a way to easily do this? I have to use statements like these often in my code and it would be nice to be able to write them in a way similar to this.</p>