Reputation: 43
I am new to Python. I am working on pandas package to analyse the work load pattern. My dataframe contains two columns with start and end time of work. I would like to filter rows of dataframe between particular start time and end time. For e.g after 7:00:00 am and before 18:00:00 pm. I tried using the following :
(df['STime'] > '7:00:00') & (df['ETime'] < '18:00:00')
But it returns False
for all rows.
Upvotes: 1
Views: 2834
Reputation: 13401
You are just comparing the values that's why you are getting only False values Use this expression with dataframe.
df=df[(df['STime'] > '7:00:00') and (df['ETime'] < '18:00:00')]
Upvotes: 1