I want to find all rows from my data frame that fall between 7am and 11am inclusive
Using this code I read a csv into a data frame with the relevent data
df = pd.read_csv(info.csv)
amount_df = pd.DataFrame(df['amount'])
datetime_df = pd.DataFrame((pd.to_datetime(df['datetime'])).dt.time)
concat_df = pd.concat([datetime_df, amount_df], axis=1)
the data frame looks like this:
| datetime | amount |
|---|---|
| 00:51:00 | 15.84 |
| 00:35:00 | 11.64 |
| 00:13:00 | 10.20 |
| 00:33:00 | 8.00 |
| 00:53:00 | 22.95 |
when I run the following code it gives me the correct times but it wont include the instances when time = 11:00:00
mask = (df['datetime'].dt.hour <= 6) & (df['datetime'].dt.hour >= 11)
concat_df = concat_df[~mask]
I have tried to use .loc but it wont return any instances of 11:00:00 exactly