how to filter out a dataframe by hours in python code example Example: pandas df filter by time hour dataset[dataset.index.hour == 9]