When converting to datetime64, pandas does:
if col_type == 'datetime64':
try:
tz = col.tzinfo
return DateTime(timezone=True)
except:
return DateTime
if col_type == 'timedelta64':
2 problems 1. The exception catch is way to broad. I think this was probably supposed to catch an AttributeException (For col with no tzinfo attribute at all) 2. columns can have a tzinfo =None, in which case a Datetime(timezone=False) should be created instead.
Comment From: jorisvandenbossche
Did you have an issue with this with an actual case? Because I don't think this code is working at all, as columns (series) have never a tzinfo
attribute.
I also mentioned this in #9086, the issue for timezone support in the sql functions.
Comment From: mangecoeur
This didn't trigger an actual bug, its more that i was looking through other issues and i noticed this bit of code didnt make sense....
Comment From: jorisvandenbossche
It indeed does not make much sense .. I am going to close this, as there is already #9086 to track this.