OverflowError: Python int too large to convert to C long on windows but not mac
You'll get that error once your 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
You can confirm this by checking:>>> import sys
>>> sys.maxsize
2147483647
To take numbers with larger precision, don't pass an int type which uses a bounded C integer behind the scenes. Use the default float:>>> preds = np.zeros((1, 3))
Python int too large to convert to C int
No. The variable is the type that it is. You can't set it to a value bigger than what it can hold. You'll have to live with a recursion depth of a mere two billion and change, instead of ten billion; I suspect you'll run out of memory before you get that many call frames deep anyway.
Related Topics
How Does Sklearn.Svm.Svc's Function Predict_Proba() Work Internally
How to Use Asyncio with Existing Blocking Library
How to Convert an Int to a Hex String
Opencv Python: Draw Minarearect ( Rotatedrect Not Implemented)
How to Write a Generator Class
Using Configparser to Read a File Without Section Name
Why How to Not Create a Wheel in Python
Powersets in Python Using Itertools
Overriding the Save Method in Django Modelform
How to Save the Pandas Dataframe/Series Data as a Figure
Python: Give Start and End of Week Data from a Given Date
How to Read Class Attributes in the Same Order as Declared
Numpy Version of "Exponential Weighted Moving Average", Equivalent to Pandas.Ewm().Mean()
Fitting a Closed Curve to a Set of Points