How can I check for NaN values? August 29, 2022 by Tarik Use math.isnan: >>> import math >>> x = float('nan') >>> math.isnan(x) True