pandas filter before and after time code example Example: pandas df filter by time hour dataset[dataset.index.hour == 9]