📜  python RuntimeWarning:long_scalars 中遇到溢出 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:26.980000             🧑  作者: Mango

代码示例1
# 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)