Skip to content

BUG: read_json converted date strings with Z to UTC #26170

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 4 commits into from
May 7, 2019

Conversation

mroeschke
Copy link
Member

@mroeschke mroeschke added IO JSON read_json, to_json, json_normalize Timezones Timezone data dtype labels Apr 21, 2019
@mroeschke mroeschke added this to the 0.25.0 milestone Apr 21, 2019
@codecov
Copy link

codecov bot commented Apr 21, 2019

Codecov Report

Merging #26170 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26170      +/-   ##
==========================================
- Coverage   91.98%   91.98%   -0.01%     
==========================================
  Files         175      175              
  Lines       52377    52384       +7     
==========================================
+ Hits        48180    48184       +4     
- Misses       4197     4200       +3
Flag Coverage Δ
#multiple 90.53% <100%> (ø) ⬆️
#single 40.72% <72.72%> (-0.14%) ⬇️
Impacted Files Coverage Δ
pandas/core/tools/datetimes.py 85.18% <100%> (+0.59%) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 96.9% <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 dc86509...e3db59f. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 21, 2019

Codecov Report

Merging #26170 into master will decrease coverage by 1.45%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26170      +/-   ##
==========================================
- Coverage   91.98%   90.53%   -1.46%     
==========================================
  Files         175      175              
  Lines       52384    52388       +4     
==========================================
- Hits        48184    47428     -756     
- Misses       4200     4960     +760
Flag Coverage Δ
#multiple 90.53% <100%> (ø) ⬆️
#single ?
Impacted Files Coverage Δ
pandas/core/tools/datetimes.py 85.05% <100%> (+0.46%) ⬆️
pandas/io/feather_format.py 21.05% <0%> (-68.43%) ⬇️
pandas/core/computation/pytables.py 62.5% <0%> (-27.75%) ⬇️
pandas/io/pytables.py 63.42% <0%> (-26.81%) ⬇️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/computation/common.py 84.21% <0%> (-5.27%) ⬇️
pandas/core/computation/expr.py 92.58% <0%> (-4.13%) ⬇️
pandas/io/formats/printing.py 84.49% <0%> (-1.07%) ⬇️
pandas/core/frame.py 96.78% <0%> (-0.24%) ⬇️
pandas/core/indexes/datetimes.py 96.69% <0%> (-0.17%) ⬇️
... and 2 more

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 7eff627...70b18ef. Read the comment docs.

try:
result = result.tz_localize('UTC').tz_convert(tz_parsed)
except AttributeError:
# Regular Index from 'ignore' path
Copy link
Contributor

Choose a reason for hiding this comment

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

how could this ever be hit as you are constructing a DTI here?

further should not all of the localization only be on this path (e.g. you must have a DTI); the way its written you could be an Index? (which is not possible)

Copy link
Member Author

Choose a reason for hiding this comment

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

Above there's

 if errors == 'ignore':
    from pandas import Index
    result = Index(result, name=name)

Where this could be an Index if there were actually errors or coerced to DatetimeIndex if there were no errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

right so what hits that? meaning if it is not coerced, then we can never attempt the localization no matter what

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah if it's not coerced to DatetimeIndex we're just returning the result (Index). array_with_unit_to_datetime above could return an object array that wouldn't get coerced to DatetimeIndex

@jreback
Copy link
Contributor

jreback commented May 7, 2019

lgtm. can you merge master; ping on green.

@WillAyd WillAyd merged commit 64c1127 into pandas-dev:master May 7, 2019
@WillAyd
Copy link
Member

WillAyd commented May 7, 2019

Thanks @mroeschke

@mroeschke mroeschke deleted the to_datetime_parse_ns branch May 7, 2019 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO JSON read_json, to_json, json_normalize Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Iso date timezone is not decoded in Series.read_json
3 participants