How to filter rows in Python pandas dataframe with duplicate values in the columns to be filtere
I think you have defined midnight as today's 00:00. Therefore, the rows before today are out of your range.

I think this may work for this cases:

# Convert string to datetime format
df['Date Time'] = pd.to_datetime(df['Date Time'])

selected_rows = df[((df['Date Time'].dt.hour * 60 + df['Date Time'].dt.minute) &gt;= 9 * 60) &amp; 
                   ((df['Date Time'].dt.hour * 60 + df['Date Time'].dt.minute) &lt;= 17 * 60)]



The filter rules use the time only and ignores the date.