0

Honestly, I'm confused.

I've got 2 datasets with different datetime formats.

One has 2019-04-13T18:30:16Z format

Another has 01.04.2019 18:57:00 format

I merged two datasets into a dataframe and I need to compare two dates in df.query('date1 == date2')

I get this error: Cannot compare tz-naive and tz-aware datetime-like objects

I tried df['datetime_1'] = df['datetime_1'].dt.tz_localize('UTC'). Then I tried df['datetime_1'] = df['datetime_1'].dt.tz_convert('UTC')

I decided to do this because

pandas.to_datetime('2019-04-13T18:30:16Z')

returns Timestamp('2017-01-12 20:50:10+0000', tz='UTC')

But I still get the same error.

How can I unify both formats?

Ruslan
  • 393
  • 1
  • 14

1 Answers1

1

dt.tz_localize(None) helped me

Ruslan
  • 393
  • 1
  • 14