-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ERR: Raise ValueError with naive datetime and mixed UTC offsets #25982
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25982 +/- ##
==========================================
- Coverage 91.85% 91.84% -0.01%
==========================================
Files 175 175
Lines 52554 52554
==========================================
- Hits 48272 48268 -4
- Misses 4282 4286 +4
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25982 +/- ##
==========================================
- Coverage 91.86% 91.85% -0.01%
==========================================
Files 175 175
Lines 52543 52543
==========================================
- Hits 48267 48262 -5
- Misses 4276 4281 +5
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -283,6 +283,7 @@ Timezones | |||
- Bug in :func:`Timestamp.tz_localize` and :func:`Timestamp.tz_convert` does not propagate ``freq`` (:issue:`25241`) | |||
- Bug in :func:`Series.at` where setting :class:`Timestamp` with timezone raises ``TypeError`` (:issue:`25506`) | |||
- Bug in :func:`DataFrame.update` when updating with timezone aware data would return timezone naive data (:issue:`25807`) | |||
- Bug in :func:`to_datetime` where an uninformative ``RuntimeError`` was raised when passing a native :class:`Timestamp` with datetime strings with mixed UTC offsets (:issue:`25978`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
native?
pandas/_libs/tslib.pyx
Outdated
@@ -792,7 +792,7 @@ cdef array_to_datetime_object(ndarray[object] values, bint is_raise, | |||
# 2) datetime strings, which we return as datetime.datetime | |||
for i in range(n): | |||
val = values[i] | |||
if checknull_with_nat(val): | |||
if checknull_with_nat(val) or isinstance(val, datetime): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyDatetimeCheck
pandas/_libs/tslib.pyx
Outdated
@@ -792,7 +792,7 @@ cdef array_to_datetime_object(ndarray[object] values, bint is_raise, | |||
# 2) datetime strings, which we return as datetime.datetime | |||
for i in range(n): | |||
val = values[i] | |||
if checknull_with_nat(val): | |||
if checknull_with_nat(val) or isinstance(val, datetime): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can yo u add a comment here, it is non-obvious why this change works
Comments addressed and green. |
thanks @mroeschke |
git diff upstream/master -u -- "*.py" | flake8 --diff