-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Computing time difference with timezone in Series with one row gives wrong result #12290
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
Comments
hmm that does look like a bug. |
Where is "-" being implemented in for |
@gfyoung that's the right place. you should just step thru. |
I was able to track the bug down to this line here. For some strange reason, the What I did was this, using a local installation of the codebase:
You should be able to see my confusion. |
that IS odd. |
Fixes unusual bug with timezone Series subtraction in which single element Series objects containing tz-aware objects would return a timedelta of zero, even though it visually could not be the case. The bug was traced to the conversion of the contained timezones to UTC, in which the method call was somehow returning NaT, even though attempts to replicate that behaviour were unsuccessful. This new method call fixes the issue and is in some ways more intuitive given the comment above the conversions. Closes pandas-devgh-12290.
When there are only one row containing timestamps with timezone in DataFrame, computing time difference between columns gives incorrect result - always '0 days':
If there are more than one row, result is correct:
One row containing timestamps in naive datetime also gives correct result:
Installed versions:
The text was updated successfully, but these errors were encountered: