-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataFrame combine_first() loses timezone information for datetime columns #10567
Comments
this is actually some older code |
Thanks. I'll await the change when it happens |
well pull-requests are always welcome. There are a ton of issues. So this will prob not be addressed for quite some time. |
@jreback Could you give some instructions on how to fix this bug? |
well, this needs to be pushed to the block manager (e.g. need a method Doing it now is going to be a bit hacky. So if you want to look to start moving it internally as in #3025 would be a good start. |
FWIW, I noticed that, in certain cases (i.e., when you are well aware of the TZs), this workaround can be used: In [16]: n['ts'].index.tz
Out[16]: <DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>
In [17]: n['ev'].index.tz
Out[17]: <DstTzInfo 'America/Los_Angeles' LMT-1 day, 16:07:00 STD>
In [18]: n['ts'].combine_first(n['ts']).index.tz
Out[18]: <DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>
In [19]: n['ts'].combine_first(n['ev']).index.tz
Out[19]: <UTC>
In [20]: n['ts'].combine_first(n['ev']).tz_convert('America/Los_Angeles').index.tz
Out[20]: <DstTzInfo 'America/Los_Angeles' LMT-1 day, 16:07:00 STD> Warning: this is my first dig into pandas. |
This looks to be fixed on master (I don't look into detail, but maybe by changes in Adding tests. |
Ah, even though tz is preserved, datetimes are incorrectly shifts (maybe the same as #12619).
|
Note that the example at the top is not really showing the issue (that seems to work in master) |
why was this closed? This still appears to be an issue |
@jackalack Can you provide a reproducible example that shows this? |
xref addl example in #13650
combine_first() loses timezone information for datetime columns
The text was updated successfully, but these errors were encountered: