Select rows of DataFrame with datetime index based on date
<p>From the following DataFrame with datetime index</p>

<pre><code>                                       'A'
2015-02-17 14:31:00+00:00           127.2801
2015-02-17 14:32:00+00:00           127.7250
2015-02-17 14:33:00+00:00           127.8010
2015-02-17 14:34:00+00:00           127.5450
2015-02-17 14:35:00+00:00           127.6300
...
2016-02-17 20:56:00+00:00            98.0900
2016-02-17 20:57:00+00:00            98.0901
2016-02-17 20:58:00+00:00            98.1000
2016-02-17 20:59:00+00:00            98.0500
2016-02-17 21:00:00+00:00            98.1100
</code></pre>

<p>I want to select all rows with a certain date, e.g. 2015-02-17. </p>

<p>Whats the best way to achieve that?</p>

<p><code>DatetimeIndex</code> supports partial datetime strings for <a href="http://pandas.pydata.org/pandas-docs/stable/timeseries.html#datetimeindex-partial-string-indexing" rel="nofollow">label based indexing</a>:</p>

<pre><code>In [18]:
df.loc['2015-02-17']

Out[18]:
                            A
2015-02-17 14:31:00  127.2801
2015-02-17 14:32:00  127.7250
2015-02-17 14:33:00  127.8010
2015-02-17 14:34:00  127.5450
2015-02-17 14:35:00  127.6300
</code></pre>

python datetime pandas