OverflowError: cannot convert float infinity to integer
时间: 2024-05-22 12:12:57 浏览: 110
Python:通用异常类型表
This error occurs when you try to convert a float value that is too large to fit into an integer type. Specifically, the error occurs when you try to convert a float value that is either positive or negative infinity to an integer.
To fix this error, you can either avoid converting infinity values to integers or use a larger data type such as a long integer (e.g. int64) to store the values. Alternatively, you can modify your code to handle infinity values differently, such as setting them to a specific value or skipping them altogether.
阅读全文