-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
OverflowError: Python int too large to convert to C long #20599
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
Interested in trying to bisect where things br3oke between 0.21.0 and 0.21.1? |
We'll also need a reproducible example. |
@TomAugspurger yes I'm interested in bisecting it. However I get a weird
Any idea ? |
I'm not sure about these lines
|
I was able to find and solve the issue. I had to apply the following patch on v0.21.0 : This issue wasn't fixed by cf9f513 |
@so your original issue is not fixed on master? Can you submit a PR fixing it, along with tests & a release note? Thanks. |
Yes it's not fixed on the master branch. It'll have to wait a bit for me to find some time. Don't you think the |
Sorry, relabeling this because I don't know yet how to reproduce. |
As far as the 0.23.0 release it still excepts but is a ValueError
$ python -c "import pandas as pd; pd.show_versions()" | grep pandas |
@ssikdar1 : Was this example working on a previous version? |
sorry guys I really didn't have time. If someone can start working from the patch I sent that'd be great. |
For v22 i get the same error:
$ python -c "import pandas as pd; pd.show_versions()" | grep pandas |
@cscetbon : Thanks for letting us know! We can continue on from here. @ssikdar1 : Does your code happen to work for |
@cscetbon : Do you have an example that we can use to test your patch? That would be helpful actually. |
@gfyoung same error for 21 unfortunately digging deeper on 23:
|
Hey @gfyoung, you can use the following content :
If I change it to
It works .. The patch I provided allows to get the same behavior as before the change. However, at that time, I didn't know that the second content would work which now makes me think there might a bug somewhere. |
@cscetbon : Thanks for this! That is indeed strange. |
you should not need to touch the ujson code at all here - it cannot work with larger than uint64 |
@jreback : That makes sense. That was also what was proposed by @cscetbon above That being said, patching is a little tricky since the issue emerges from argument validation on the def loads(*args, **kwargs):
try:
return json.loads(*args, **kwargs)
except OverflowError:
# type coercion, etc. |
no patching like this will not be accepted there are 2 issues:
|
Still got this error today Code to reproduce import pandas as pd
e = 4
rng_srt = 9*10**300 # range start
rng_end = 11*10**300 # range end
p = pd.DataFrame(dtype=object) # potencies p
p['b'] = pd.Series(range(rng_srt,rng_end+1)) # base b
p['e'] = n # exponent e
p['v'] = [value**e for value in p['b']] # value v
p.tail() |
@mondaysunrise you are commenting on an issue about json parsing you cannot hold these large ints directly and must use object dtype on the Series you are constructing |
Okay, sorry, I was missing that. Thank you for telling me. |
take I'd like to fix this in the |
Posted test case in #26068 |
Code Sample, a copy-pastable example if possible
Problem description
This issue happens on
0.21.1
+ and doesn't happen on0.21.0
for instance. I also tried it using the last master branch 0.23.0 and got the same issue :Expected Output
It should not crash ...
Output of
pd.show_versions()
Here is the one working :
And one failing :
The text was updated successfully, but these errors were encountered: