I have the below dataframe in csv file, I would like to select all rows corresponding to current hour.
time,values
2018-10-28 08:16:49.469508,48
2018-10-28 08:16:54.471987,48
2018-10-28 08:16:59.475236,48
2018-10-28 08:17:04.478681,48
Below is the funtion I am trying current = datetime.datetime.now()
start = datetime.datetime(current.year,current.month,current.day,current.hour,0)
end = datetime.datetime(current.year,current.month,current.day,current.hour,59)
df = pd.io.parsers.read_csv('water_data1.csv', parse_dates=[0], index_col=0)
print(df.query('start < time < end'))
I get the following error
pandas.core.computation.ops.UndefinedVariableError: name 'start' is not defined
Could someone suggest what is the right syntax to achieve this. Thanks Hemanth