I'm trying to merge dataframes that are either daily or hourly. It seems on the first iteration through my loop, I can merge the first daily with hourly values. But the second time around I get this error:
raise Exception('Cannot join tz-naive with tz-aware DatetimeIndex')
Exception: Cannot join tz-naive with tz-aware DatetimeIndex
I can't really provide a good example, but I now that all the dataframes are tz-aware when they are created (e.g. I call df.tz_localize('UTC')
on each after it is created.
I think the easiest thing to do would be to make your frames non-timezone aware (timezone unaware?). Maybe
df_no_tz = df.copy()
df_no_tz.index.tz = None
I don't know, but it sounds like something in pandas
is either creating a frame without a timezone, or removing your timezone information. Making the frames timezone agnostic may fix this (if this is what it is, implying this is a bug in pandas
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With