• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes

Problem :

While I am running the python code on windows with python 3.5 64 bit. Getting below error.

 overflowerror: python int too large to convert to c long

by (6.9k points)  

1 Answer

0 votes

Solution :

The issue is because the numbers are greater than sys.maxsize:

>>> p = [sys.maxsize]
>>> preds[0] = p
>>> p = [sys.maxsize+1]
>>> preds[0] = p
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long

Please confirm this by checking:

>>> import sys >>> sys.maxsize 

To resolve the issue use the default float:

>>> preds = np.zeros((1, 3))

Further Readings:


by (29.7k points)  
edited by