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))
Related Posts:
- “OverflowError: Python int too large to convert to C long” on windows but not mac
- How can I install pip on Windows?
- PermissionError: [Errno 13] Permission denied
- Permanently add a directory to PYTHONPATH?
- How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
- anaconda – path environment variable in windows
- How to remove anaconda from windows completely?
- How to clear the interpreter console?
- How to install pip3 on Windows?
- Python Setup Disabling Path Length Limit Pros and Cons?
- How to clear the interpreter console?
- Installing tensorflow with anaconda in windows
- error: Unable to find vcvarsall.bat
- error: Unable to find vcvarsall.bat
- ‘pip3’ is not recognized as an internal or external command, operable program or batch file
- Git Bash won’t run my python files?
- How to install xgboost in Anaconda Python (Windows platform)?
- No Module Named ‘_pywrap_tensorflow_internal’
- Convert bytes to int?
- How to install pytorch in windows?
- How to install PyQt5 on Windows?
- How to stop Python closing immediately when executed in Microsoft Windows
- “ImportError: No module named site” on Windows
- How to downgrade the installed version of ‘pip’ on windows?
- Pip – Fatal error in launcher: Unable to create process using ‘”‘
- python pip on Windows – command ‘cl.exe’ failed
- Windows- Pyinstaller Error “failed to execute script ” When App Clicked
- python is not recognized windows 10
- Anaconda Installed but Cannot Launch Navigator
- ImportError: No module named cv2
- How to get the text cursor position in Windows?
- ImportError: cannot import name NUMPY_MKL
- Open File in Another Directory (Python)
- How to know/change current directory in Python shell?
- Python official installer missing python27.dll
- “Python version 2.7 required, which was not found in the registry” error when attempting to install netCDF4 on Windows 8
- Error: No module named ‘fcntl’
- What is the maximum float in Python?
- Anaconda “failed to create process”
- Using Python 3 in virtualenv
- “Series objects are mutable and cannot be hashed” error
- Putting a simple if-then-else statement on one line [duplicate]
- matplotlib savefig() plots different from show()
- Converting list to numpy array
- How do I parse a string to a float or int?
- Check if something is (not) in a list in Python
- How to parse data in JSON format?
- TypeError: unhashable type: ‘dict’
- ‘Conda’ is not recognized as internal or external command
- Python list of dictionaries search
- What is the difference between Spyder and Jupyter?
- What is the maximum recursion depth in Python, and how to increase it?
- subprocess.check_output return code
- Is arr.__len__() the preferred way to get the length of an array in Python?
- Max retries exceeded with URL in requests
- Create 3D array using Python
- How to load a tsv file into a Pandas DataFrame?
- The tilde operator in Python
- Explain __dict__ attribute
- Python command not working in command prompt
- How to pretty print nested dictionaries?
- Is there a linked list predefined library in Python?
- return, return None, and no return at all?
- What does [:-1] mean/do in python? [duplicate]
- How to filter Pandas dataframe using ‘in’ and ‘not in’ like in SQL
- Create empty file using python [duplicate]
- TypeError: string indices must be integers, not str // working with dict
- How do I print colored output to the terminal in Python?
- Dictionary in a numpy array?
- Pythonic way to find maximum value and its index in a list?
- Why is there no tuple comprehension in Python?
- You are trying to add a non-nullable field ‘new_field’ to userprofile without a default
- How to calculate a Gaussian kernel matrix efficiently in numpy?
- AttributeError: Can only use .str accessor with string values, which use np.object_ dtype in pandas
- Python Pandas ValueError Arrays Must be All Same Length
- Anaconda / Python: Change Anaconda Prompt User Path
- Pycharm and sys.argv arguments
- ImportError: No module named ‘yaml’
- TypeError: ‘_io.TextIOWrapper’ object is not subscriptable
- super(type, obj): obj must be an instance or subtype of type
- What does “hashable” mean in Pytho
- PIL: DLL load failed: specified procedure could not be found
- “Cannot access setup.py: No such file or directory” – can’t run any .py files?
- How to delete a specific line in a file?
- How does ajax work with python?
- RSA encryption and decryption in Python
- pip3 error – ‘_NamespacePath’ object has no attribute ‘sort’
- What does {0} mean in this Python string?
- Tab Error in Python
- Installation of pygame with Anaconda
- Is there a Python equivalent of the C# null-coalescing operator?
- What is the meaning of “int(a[::-1])” in Python?
- Pandas unstack problems: ValueError: Index contains duplicate entries, cannot reshape
- How do I read image data from a URL in Python?
- ‘pyuic5’ is not recognized as an internal or external command
- ValueError: multiclass format is not supported
- Filtering a NumPy Array
- Invalid syntax when using “print”?
- Error loading MySQLdb module: No module named ‘MySQLdb’
- Unable to install boto3