<s>[INST] How to check for NaN in python? float('nan') results in a thingy simply called nan. But how do I check for it? Should be very easy, but i cannot find it.
 [/INST] math.isnan()

Checks if the float x is a NaN (not a number). NaNs are part of the IEEE 754 standards. Operation like but not limited to inf * 0, inf / inf or any operation involving a NaN, e.g. nan * 1, return a NaN.
New in version 2.6.

>>> import math
>>> x=float('nan')
>>> math.isnan(x)
True
>>>

 </s>