Using DataFrames with a DatetimeIndex opens the door to many new and different operations as seen with several recipes in this chapter.
Grouping with anonymous functions with a DatetimeIndex
Getting ready
In this recipe, we will show the versatility of using the groupby method for DataFrames that have a DatetimeIndex.
How to do it...
- Read in the Denver crime hdf5 file, place the REPORTED_DATE column in the index, and sort it:
>>> crime_sort = pd.read_hdf('data/crime.h5', 'crime') \
.set_index('REPORTED_DATE') ...