isnan(x) function checks whether x is not a number (NaN). It's a method of math module. Python NaN is represented as float('nan').
isnan(x)
math
float('nan')
>>> import math >>> math.isnan(float('nan'))
True