There are functions in NumPy, math, and pandas libraries that you can use to check NaN values. Here is a simple example to check if a value is NaN.
>>> import math
>>> import numpy as np
>>> import pandas as pd
>>> t=float('nan')
>>> t
nan
>>> math.isnan(t)
True
>>> pd.isna(t)
True
>>> np.isnan(t)
True
>>> b=0.1
>>> np.isnan(b)
False
>>> math.isnan(b)
False
>>> pd.isna(b)
False