- Read in the Denver crime hdf5 dataset leaving the REPORTED_DATE as a column:
>>> crime = pd.read_hdf('data/crime.h5', 'crime')>>> crime.head()
- All Timestamp columns have a special attribute called the dt accessor, which gives access to a variety of extra attributes and methods specifically designed for them. Let's find the weekday name of each REPORTED_DATE and then count these values:
>>> wd_counts = crime['REPORTED_DATE'].dt.weekday_name \ .value_counts()>>> wd_countsMonday 70024 Friday 69621 Wednesday 69538 Thursday 69287 Tuesday 68394 Saturday 58834 Sunday 55213 Name: REPORTED_DATE, dtype: int64
- The weekends appear ...