code: def ensure_valid_nums_in_specification_cols(specification, dataframe):
      
      problem_cols = []
      for col in specification:
          # The condition below checks for values that are not floats or integers
          # This will catch values that are strings.
          if dataframe[col].dtype.kind not in ['f', 'i', 'u']:
              problem_cols.append(col)
          # The condition below checks for positive or negative inifinity values.
          elif np.isinf(dataframe[col]).any():
              problem_cols.append(col)
          # This condition will check for NaN values.
          elif np.isnan(dataframe[col]).any():
              problem_cols.append(col)
  
      if problem_cols != []:
          msg = "The following columns contain either +/- inifinity values, "
          msg_2 = "NaN values, or values that are not real numbers "
          msg_3 = "(e.g. strings):\n{}"
          total_msg = msg + msg_2 + msg_3
          raise ValueError(total_msg.format(problem_cols))
  
      return None
docs: Checks whether each column in `specification` contains numeric data,
      excluding positive or negative infinity and excluding NaN. Raises
      ValueError if any of the columns do not meet these requirements.
  
      Parameters
      ----------
      specification : iterable of column headers in `dataframe`.
      dataframe : pandas DataFrame.
          Dataframe containing the data for the choice model to be estimated.
  
      Returns
      -------
      None.