Skip to content

BUG: read_json(orient="table") raising for tz-naive datetime fields with offsets (GH#52595) - #71322

Open
jbrockmendel wants to merge 1 commit into
pandas-dev:mainfrom
jbrockmendel:bug-52595
Open

jbrockmendel wants to merge 1 commit into
pandas-dev:mainfrom
jbrockmendel:bug-52595

Conversation

@jbrockmendel

Copy link
Copy Markdown
Member

closes #52595

pandas<1.5 wrote tz-naive datetimes with a Z suffix (fixed in GH-38760), so orient="table" JSON from those versions has a {"type": "datetime"} field with no "tz" whose values carry an offset. Since 2.0 the astype("datetime64[ns]") in parse_table_schema refuses these and read_json raises. Such fields are now cast to UTC and the tz dropped, giving the tz-naive UTC wall time as 1.5.3 did. Values without an offset are unaffected, and parsing still goes through the same astype, so non-ISO strings and error messages are unchanged.

AI disclosure: drafted with Claude Code (claude opus 5.5 (high)), used to diagnose the regression, write the fix and test, and review the branch.

@jbrockmendel jbrockmendel added Bug Regression Functionality that used to work in a prior pandas version IO JSON read_json, to_json, json_normalize labels Oct 19, 2026
@jbrockmendel
jbrockmendel marked this pull request as ready for review October 19, 2026 21:50
…ith offsets (GH#52595)

pandas<1.5 wrote tz-naive datetimes with a "Z" suffix, so table-orient
JSON from those versions failed to read since 2.0. Parse such fields as
UTC and drop the tz, matching 1.5.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug IO JSON read_json, to_json, json_normalize Regression Functionality that used to work in a prior pandas version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: json that could be read by pandas 1.5.3 cannot be read by 2.0.0

1 participant