if nan then check python code example Example 1: python test is nan math.isnan(n) Example 2: check if value is NaN Number.isNaN(123)