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”
- Create a file if it doesn’t exist
- Python datetime to string without microsecond component
- ImportError: No module named pandas
- How to change the order of DataFrame columns?
- How to move a file in Python?
- RuntimeWarning: invalid value encountered in divide
- IndentationError: unexpected indent error
- Numpy ValueError: setting an array element with a sequence. This message may appear without the existing of a sequence?
- Python SyntaxError :’return’ outside function
- Python error “ImportError: No module named”
- Error: ” ‘dict’ object has no attribute ‘iteritems’ “
- pandas DataFrame “no numeric data to plot” error
- How to upgrade pip3?
- SyntaxError: multiple statements found while compiling a single statement
- Getting key with maximum value in dictionary?
- Why is the apt-get function not working in the terminal on Mac OS X v10.9 (Mavericks)?
- How do I parallelize a simple Python loop?
- TypeError: ‘str’ object cannot be interpreted as an integer [duplicate]
- Updating matplotlib in virtualenv with pip
- Is the standard Python implementation considered as a programming language or a scripting language?
- Python – from . import
- SystemError: Parent module ” not loaded, cannot perform relative import
- What is a mixin, and why are they useful?
- Python equivalent to ‘hold on’ in Matlab
- What does __contains__ do, what can call __contains__ function
- Python: find position of element in array
- How to get pip to work behind a proxy server
- How to POST JSON data with Python Requests?
- Determine the type of an object?
- enumerate() for dictionary in python
- How to convert a PIL Image into a numpy array?
- Two dimensional array in python
- printing a two dimensional array in python
- min() arg is an empty sequence
- How can I open an Excel file in Python?
- No module named “Torch”
- How do I convert hex to decimal in Python?
- What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?
- How to get all subsets of a set? (powerset)
- Python throws ValueError: list.remove(x): x not in list
- How can I remove all instances of an element from a list in Python?
- Data type conversion error: ValueError: Cannot convert non-finite values (NA or inf) to integer
- Create an empty list in Python with certain size
- Plotting multiple lines, in different colors, with pandas dataframe
- TypeError: cannot concatenate a non-NDFrame object
- What causes a Python segmentation fault?
- function is not defined error in Python
- Need to install urllib2 for Python 3.5.1
- Could not install packages due to an EnvironmentError: [Errno 13]
- No module named django but it is installed
- What is the purpose of dollar sign in this Python3 string formatting expression?
- Superscript in Python plots
- threshold in 2D numpy array
- What is the difference between ‘SAME’ and ‘VALID’ padding in tf.nn.max_pool of tensorflow?
- How to install NumPy for Python 3.6
- Hashing arrays in Python
- Mutable strings in Python
- Inserting image into IPython notebook markdown
- Writing Python lists to columns in csv
- python’s re: return True if string contains regex pattern
- How to import a csv-file into a data array?