Back
float('nan') results in Nan (not a number). But how do I check for it? Should be very easy, but I cannot find it.
You can use math.isnan(x)to check for NaN values this will Return True if x is a NaN (not a number), and False otherwise.
>>> import math >>> x = float('nan') >>> math.isnan(x) True
>>> import math
>>> x = float('nan')
>>> math.isnan(x)
True
30.9k questions
32.9k answers
500 comments
665 users