I'm trying to see if the 'DateTime_Added' rows in the df are within the last 2 days of the execution date.
execution_date = context.get("execution_date")
printed execution_date: `2022-02-14T01:00:00+00:00`
printed type execution_date: `<class 'pendulum.datetime.DateTime'>`
last_2_days=execution_date - timedelta(hours=48)
printed last_2_days: 2022-02-12T01:00:00+00:00
printed type last_2_days: <class 'pendulum.datetime.DateTime'>
I've converted the DateTime_Added
col to datetime because it was string before:
df['DateTime_Added'] = pd.to_datetime(df['DateTime_Added'])
print df.info()
DateTime_Added 2 non-null datetime64[ns]
comment 3080 non-null object
then when I try to run this I see can't compare offset-naive and offset-aware datetimes
:
if row['comment'] is not None and row['comment'] != '' and
row['DateTime_Added'] is not None and row['DateTime_Added'] != ''
and (last_2_days <= row['DateTime Comment Added'] <= execution_date):