-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
@@ -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"] |
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 you replace other instances of table["schema"]["fields"]
below with fields
?
@@ -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): |
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.
if any(not isinstance(field["name"], str) for field in fields): | |
if not all(isinstance(field["name"], str) for field in fields): |
NIt: IMO this reads a little clearer with me
Hi, it seems there is already a PR #60945 addressing this issue. |
Looking forward to feedback. Thanks!