Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BUG: Raise ValueError for non-string columns in read_json orient='table' (GH19129)#61359

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
amoitra1 wants to merge3 commits intopandas-dev:main
base:main
Choose a base branch
Loading
fromamoitra1:fix-read_json-table-validation

Conversation

amoitra1
Copy link

@amoitra1amoitra1 commentedApr 26, 2025
edited by mroeschke
Loading

Looking forward to feedback. Thanks!

@amoitra1
Copy link
Author

pre-commit.ci autofix

pre-commit-ci[bot] reacted with rocket emoji

@@ -372,6 +372,11 @@ def parse_table_schema(json, precise_float: bool) -> DataFrame:
pandas.read_json
"""
table = ujson_loads(json, precise_float=precise_float)
fields = table["schema"]["fields"]
Copy link
Member

Choose a reason for hiding this comment

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

Can you replace other instances oftable["schema"]["fields"] below withfields?

@@ -372,6 +372,11 @@ def parse_table_schema(json, precise_float: bool) -> DataFrame:
pandas.read_json
"""
table = ujson_loads(json, precise_float=precise_float)
fields = table["schema"]["fields"]

if any(not isinstance(field["name"], str) for field in fields):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ifany(notisinstance(field["name"],str)forfieldinfields):
ifnotall(isinstance(field["name"],str)forfieldinfields):

NIt: IMO this reads a little clearer with me

@mroeschkemroeschke added Error ReportingIncorrect or improved errors from pandas IO JSONread_json, to_json, json_normalize labelsApr 28, 2025
@yuanx749
Copy link
Contributor

Hi, it seems there is already a PR#60945 addressing this issue.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mroeschkemroeschkemroeschke left review comments

Assignees
No one assigned
Labels
Error ReportingIncorrect or improved errors from pandasIO JSONread_json, to_json, json_normalize
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Raise ValueError for read_json and orient='table' With Numeric Column Names
3 participants
@amoitra1@yuanx749@mroeschke

[8]ページ先頭

©2009-2025 Movatter.jp