Get an error message that says "Cannot convert non-finite values (NA or inf) to integer" despite me not having any infinity or NA values

Viewed 28315

I have code that I have written where I rerun the script every single day using newly updated data. Every day this script works fine and there is no problem. Today I got an error message that says:

ValueError: Cannot convert non-finite values (NA or inf) to integer

after I use the following code:

 Flash_Bookings['ContractTermMonths'] = Flash_Bookings['ContractTermMonths'].astype(int)

The column that it's referring to has only about 400 rows and I just checked that not a single one of them is an NA or inf.

What could be the problem here if I don't have inf or NA values in that column?

0 Answers
Related