code: def substitute_values(self, vect):
          
  
          try:
              unique = np.unique(vect)
          except:
              unique = set(vect)
  
          unique = [
              x for x in unique if not isinstance(x, float) or not isnan(x)
          ]
  
          arr = np.copy(vect)
          for new_id, value in enumerate(unique):
              np.place(arr, arr==value, new_id)
              self.metadata[new_id] = value
          arr = arr.astype(np.float)
          np.place(arr, np.isnan(arr), -1)
          self.arr = arr
  
          if -1 in arr:
              self.metadata[-1] = self._missing_id
docs: Internal method to substitute integers into the vector, and construct
          metadata to convert back to the original vector.
  
          np.nan is always given -1, all other objects are given integers in
          order of apperence.
  
          Parameters
          ----------
          vect : np.array
              the vector in which to substitute values in