Код: Выделить всё
df = pandas.read_sql('Database count details', con=engine,
index_col='id', parse_dates='newest_available_date')
Код: Выделить всё
id code newest_date_available
9793708 3514 2015-12-24
9792282 2399 2015-12-25
9797602 7452 2015-12-25
9804367 9736 2016-01-20
9804438 9870 2016-01-20
Код: Выделить всё
date_before = datetime.date.today() - datetime.timedelta(days=7) # Which is 2016-01-20
Код: Выделить всё
if (df['newest_available_date'] < date_before):
print(#all rows)
Код: Выделить всё
The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Подробнее здесь: https://stackoverflow.com/questions/361 ... ring-dates