I have this data frame, where id is an int64, and date is datetime64[ns]:
id date
0 1811302 2017-03-08 00:00:00.000000
1 16095 2013-03-12 00:00:00.000000
2 16095 2017-09-15 00:00:00.000000
.. ... ...
74 1111806 2017-09-15 00:00:00.000000
75 482254 2013-01-01 00:00:00.000000
76 482254 2015-12-16 00:00:00.000000
In reality, my data frame has more than a million number of rows.
Now, using pandasql, how do I extract rows before a given date, say before 2017-09-11?
I tried:
sqlcode = 'SELECT id, date from df where strftime("%Y-%m-%d", date) < {}'.format("2017-09-11")
ps.sqldf(sqlcode,locals())
Which returns nothing:
Empty DataFrame
Columns: [id, date]
Index: []
Any suggestions?