There are a number of DataFrame/Series methods that only work with a DatetimeIndex. If the index is of any other type, these methods will fail.
Using methods that only work with a DatetimeIndex
Getting ready
In this recipe, we will first use methods to select rows of data by their time component. We will then learn about the powerful DateOffset objects and their aliases.
How to do it...
- Read in the crime hdf5 dataset, set the index as REPORTED_DATE, and ensure that we have a DatetimeIndex:
>>> crime = pd.read_hdf('data/crime.h5', 'crime'...