How to check for NaN values September 30, 2023 by Tarik Use math.isnan: >>> import math >>> x = float('nan') >>> math.isnan(x) True