-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
read_json: ValueError: Value is too big #26068
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
Workaround:A workaround that worked for me is to patch the import pandas.io.json
# monkeypatch using standard python json module
import json
pd.io.json._json.loads = lambda s, *a, **kw: json.loads(s)
# monkeypatch using faster simplejson module
import simplejson
pd.io.json._json.loads = lambda s, *a, **kw: simplejson.loads(s)
# normalising (unnesting) at the same time (for nested jsons)
pd.io.json._json.loads = lambda s, *a, **kw: pandas.io.json.json_normalize(simplejson.loads(s)) After this patch Suggestion for future solution:A possible solution for pandas is to provide a parameter via which one can override (inject) the |
Going to close this issue as I believe it's the same issue as #20599 |
I don't think this issue is solved. Test data (test.csv:):
Test code:
Results in error:
then:
This behavior is therefore inconsistent. (Pandas 1.3.4, json 2.0.9, numpy 1.21.3) |
@deponovo this was redirected to another open issue - look there and see if the example is sufficient issue get fixed when the members of the community puts up pull requests the core team can provide code review |
Is there a wiki how I could do this? Would be my first time. |
take |
I'm using pandas 1.4.1 and can still reproduce this issue:
Sorry one thing to note: it seems the output (to_json) knows this is a problem and puts the type as string, but still writes to the json as an python long (instead of a string): '{"schema":{"fields":[{"name":"index","type":"integer"},{"name":"foo","type":"string"}],"primaryKey":["index"],"pandas_version":"1.4.0"},"data":[{"index":0,"foo":441350462101887021235463396661461057}]}' |
@deponovo Would it be helpful to open a new issue for this? Is it ok to do the json overrides I see in other related issues, is it a performance trade off and that is why pandas uses a custom json parser? |
Workaround posted above doesn't seem to work anymore. Does anyone have a new workaround that works? |
Reopening issue #14530. The close description is incorrect. The JSON specification explicitly states that limits are not in the specification.
From https://tools.ietf.org/html/rfc7159#section-6
The standard
json
library in python supports large numbers, meaning the language supports JSON with these values.The text was updated successfully, but these errors were encountered: