擅长:python、mysql、java
<p>我认为它不起作用,因为在<code>datetimeindex</code>和<code>floatindex</code>中可能存在精度问题。你知道吗</p>
<p>您可以使用<a href="http://pandas.pydata.org/pandas-docs/stable/timeseries.html#datetimeindex-partial-string-indexing" rel="nofollow">partial string indexing</a>,其中我省略了datetime结尾的数字-我只使用秒:</p>
<pre><code>print df['2015-12-02 12:02:19':'2015-12-02 12:40:20']
Sell
DateTime
2015-12-02 12:02:19.250 1.05906
2015-12-02 12:02:19.860 1.05906
2015-12-02 12:02:20.470 1.05906
</code></pre>