-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Whole JSON gets dumped from error in _pull_records() #56405
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
Comments
Thanks for the report. Maybe raise TypeError(f"{spec} contains {type(result).__name__}. Must be list or null.") to at least inform of the type present that isn't a list or null |
Yes, great idea. I'd add back the word "path" since "spec" isn't mentioned in the docs. And while we're here, raise TypeError(f"path {spec!r} contains {type(result).__name__}. Must be list or null.") which would be in this case:
|
Or you might want to move the path to the end in case it too is bulky: raise TypeError(f"path must contain list or null, but got {type(result).__name__} at {spec!r}") |
I think your suggestion in #56405 (comment) looks good. Happy to have a PR! |
take |
…#56405) (pandas-dev#56802) change the prompt on non list record path errors
Uh oh!
There was an error while loading. Please reload this page.
This error message shows the entire JSON, then the erroring part, both of which can be very large.
pandas/pandas/io/json/_normalize.py
Lines 429 to 432 in 68c1af5
Example:
Error (clipped for readability):
(Here I've clipped the
'Time Series (5min)'
value, but it takes up an order of magnitude more space.)I believe the error could be changed to simply:
Then if you need more information, you can inspect
data[spec]
.Although, that wouldn't be ideal for cases where you've inlined the data retrieval, like
pd.json_normalize(requests.get(url).json(), 'Meta Data')
.The text was updated successfully, but these errors were encountered: