python check string or nan code example Example 1: python test is nan math.isnan(n) Example 2: check is string is nan python >>> pd.isnull(None) True