code: def clean_val_nan_version(key, val, replacement_val=np.nan):
      try:
          str_val = str(val)
      except UnicodeEncodeError as e:
          str_val = val.encode("ascii", "ignore").decode("ascii")
          print(
              "Here is the value that causes the UnicodeEncodeError to be thrown:"
          )
          print(val)
          print("Here is the feature name:")
          print(key)
          raise (e)
  
      if str_val in bad_vals_as_strings:
          return replacement_val
      else:
          try:
              float_val = float(val)
          except ValueError:
              # remove any commas in the string, and try to turn into a float again
              try:
                  cleaned_string = val.replace(",", "")
              except TypeError:
                  print("*************************************")
                  print(
                      "We expected this value to be numeric, but were unable to convert it to a float:"
                  )
                  print(val)
                  print("Here is the feature name:")
                  print(key)
                  print("*************************************")
                  return replacement_val
              try:
                  float_val = float(cleaned_string)
              except:
                  return replacement_val
          except TypeError:
              # This is what happens if you feed in a datetime object to float
              print("*************************************")
              print(
                  "We expected this value to be numeric, but were unable to convert it to a float:"
              )
              print(val)
              print("Here is the feature name:")
              print(key)
              print("*************************************")
              return replacement_val
  
          return float_val
  
imports: import datetime
  import os
  import dateutil
  import numpy
  import pandas
  from pandas import __version__
  import pathos
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.feature_extraction.text import TfidfVectorizer
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: clean_val_nan_version(key, val, replacement_val) and returns: replacement_val, float_val, replacement_val, replacement_val, replacement_val