Skip to content

Commit 8d7d4c2

Browse files
committed
DOC: datetime example in timeseries.rst
1 parent f6b40dd commit 8d7d4c2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/source/timeseries.rst

+18
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,24 @@ We are stopping on the included end-point as its part of the index
348348
dft.loc['2013-1-15 12:30:00']
349349
350350
351+
Datetime Indexing
352+
~~~~~~~~~~~~~~~~~
353+
354+
Indexing a ``DateTimeIndex`` with a partial string depends on the "accuracy" of the period, in other words how specific the interval is in relation to the frequency of the index. In contrast, indexing with datetime objects is exact, because the objects have exact meaning. These also follow the sematics of *including both endpoints*.
355+
356+
These ``datetime`` objects are specific ``hours, minutes,`` and ``seconds`` even though they were not explicity specified (they are ``0``).
357+
358+
.. ipython:: python
359+
360+
dft[datetime(2013, 1, 1):datetime(2013,2,28)]
361+
362+
With no defaults.
363+
364+
.. ipython:: python
365+
366+
dft[datetime(2013, 1, 1, 10, 12, 0):datetime(2013, 2, 28, 10, 12, 0)]
367+
368+
351369
Truncating & Fancy Indexing
352370
~~~~~~~~~~~~~~~~~~~~~~~~~~~
353371

0 commit comments

Comments
 (0)