Back to Community
How to judge Nan?

For example:
my python code is:
price=data[context.stock].price
if(price is Nan):
pass

the IDE show me the error: "Error Runtime exception: NameError: global name 'Nan' is not defined".
I want to know how to indicate the Nan? How to charge judge whether the price is Nan or not?
Thank you very much.

2 responses

something like this?

if context.stock in data:  
   #into these statements if there are valid data points  
else:  
    # code for missing data points  

if you have multiple securities you can use the same code and just loop through to check each