title: Pandas time series indexing -- re
body: <p>I have a pandas dataframe indexed by time:</p>
  
  <pre><code>&gt;&gt;&gt; dframe.head()
                       aw_FATFREEMASS raw aw_FATFREEMASS sym
  TIMESTAMP
  2011-12-08 23:13:23               139.3                  H
  2011-12-08 23:12:18               139.2                  H
  2011-12-08 22:31:53               139.2                  H
  2011-12-09 07:08:50               138.2                  H
  2011-12-10 21:36:20               137.6                  H
  
  [5 rows x 2 columns]
  
  &gt;&gt;&gt; type(dframe.index)
  &lt;class 'pandas.tseries.index.DatetimeIndex'&gt;
  </code></pre>
  
  <p>I'm trying to do a simple time series query similar to this SQL:</p>
  
  <pre><code>SELECT * FROM dframe WHERE tstart &lt;= TIMESTAMP &lt;= tend
  </code></pre>
  
  <p>where tstart and tend are appropriately represented timestamps.  With pandas I'm getting behavior I just don't understand.</p>
  
  <p>This does what I expect:</p>
  
  <pre><code>&gt;&gt;&gt; dframe['2011-11-01' : '2011-11-20']
  Empty DataFrame
  Columns: [aw_FATFREEMASS raw, aw_FATFREEMASS sym]
  Index: []
  [0 rows x 2 columns]
  </code></pre>
  
  <p>This does the same thing:</p>
  
  <pre><code>dframe['2011-11-01 00:00:00' : '2011-11-20 00:00:00']
  </code></pre>
  
  <p>However:</p>
  
  <pre><code>&gt;&gt;&gt; from dateutil.parser import parse
  &gt;&gt;&gt; dframe[parse('2011-11-01 00:00:00') : '2011-11-20 00:00:00']
  *** TypeError: 'datetime.datetime' object is not iterable
  &gt;&gt;&gt; dframe[parse('2011-11-01') : '2011-11-20 00:00:00']
  *** TypeError: 'datetime.datetime' object is not iterable
  &gt;&gt;&gt; dframe[parse('2011-11-01') : parse('2011-11-01')]
  *** KeyError: Timestamp('2011-11-01 00:00:00', tz=None)
  </code></pre>
  
  <p>When I provide a time represented as a pandas Timestamp I get slice behavior I don't understand.  Can someone explain this behavior and/or tell me how I can achieve the SQL query above?</p>