code: def is_scalar_nan(x):
      
  
      # convert from numpy.bool_ to python bool to ensure that testing
      # is_scalar_nan(x) is True does not fail.
      # Redondant np.floating is needed because numbers can't match np.float32
      # in python 2.
      return bool(isinstance(x, (numbers.Real, np.floating)) and np.isnan(x))
docs: Tests if x is NaN
      This function is meant to overcome the issue that np.isnan does not allow
      non-numerical types as input, and that np.nan is not np.float('nan').
      Parameters
      ----------
      x : any type
      Returns
      -------
      boolean
      Examples
      --------
      >>> is_scalar_nan(np.nan)
      True
      >>> is_scalar_nan(float("nan"))
      True
      >>> is_scalar_nan(None)
      False
      >>> is_scalar_nan("")
      False
      >>> is_scalar_nan([np.nan])
      False