Answers for "python overflow encountered in long_scalars"

2

python RuntimeWarning: overflow encountered in long_scalars

# Error:
RuntimeWarning: overflow encountered in long_scalars

# Solution:
# This error usually comes up because the data type you're using can't 
# handle the size of number you're trying to manipulate. For example,
# the largest number you can manipulate with int32 is 2147483647. 
# Depending on the size of numbers you're dealing with, setting the data
# type to int64 or float64 might solve the problem. E.g.:
numpy_array = np.array(my_list, dtype=numpy.float64)
Posted by: Guest on October-04-2020

Code answers related to "python overflow encountered in long_scalars"

Python Answers by Framework

Browse Popular Code Answers by Language