Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
ValueError: cannot convert float NaN to integer

I am getting "ValueError: cannot convert float NaN to integer" in line 58 in handle_data()

Can someone please help me ??

Thanks in advance !!!

1 response

attached an updated algo.

import numpy as np - at the beginning so you have access to numpy's isnan() function
put an if/else statement around the stock_price variable to check if stock_price is nan, and if it is I set the variable to zero.

Hope that fixes your issue.
Cory