Indexing using DatetimeIndex

The core of the time-series functionality in pandas revolves around the use of specialized indexes that represent measurements of data at one or more timestamps. These indexes in pandas are referred to as DatetimeIndex objects. These are incredibly powerful objects, and they allow us to automatically align data based on dates and times.

There are several ways to create DatetimeIndex objects in pandas. The following creates a DateTimeindex by passing a list of datetime objects to a Series:

This Series has taken the datetime objects and constructed a DatetimeIndex from the date values. Each value of that index is ...

Get Learning pandas - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.