Skip to content

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

Merged
merged 5 commits into from
Apr 4, 2019

Conversation

mroeschke
Copy link
Member

@mroeschke mroeschke added Error Reporting Incorrect or improved errors from pandas Timezones Timezone data dtype labels Apr 3, 2019
@mroeschke mroeschke added this to the 0.25.0 milestone Apr 3, 2019
@codecov
Copy link

codecov bot commented Apr 3, 2019

Codecov Report

Merging #25982 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.4% <ø> (ø) ⬆️
#single 41.91% <ø> (-0.08%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 75% <0%> (-12.5%) ⬇️
pandas/core/frame.py 96.79% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1172d61...acd7128. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 3, 2019

Codecov Report

Merging #25982 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.4% <ø> (ø) ⬆️
#single 41.9% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 75% <0%> (-12.5%) ⬇️
pandas/core/frame.py 96.79% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.62% <0%> (-0.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70773d9...b474f88. Read the comment docs.

@@ -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`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

native?

@@ -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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyDatetimeCheck

@@ -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):
Copy link
Contributor

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

@mroeschke
Copy link
Member Author

Comments addressed and green.

@jreback jreback merged commit 59feac7 into pandas-dev:master Apr 4, 2019
@jreback
Copy link
Contributor

jreback commented Apr 4, 2019

thanks @mroeschke

@mroeschke mroeschke deleted the timezone_mixed_raises branch April 4, 2019 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The error when as_datetime acts on multiple timezones is not useful
3 participants