docs: def _preprocess_data_for_tabular_explain(self, df, categories):
          """Get preprocessed training set in numpy array, and categorical names from raw training data.
  
          LIME tabular explainer requires a training set to know the distribution of numeric and
          categorical values. The training set has to be numpy arrays, with all categorical values
          converted to indices. It also requires list of names for each category.
          """
  
          df = df.copy()
  
          # Remove non tabular columns (text, image).
          for col in list(df.columns):
              if col not in (self._categorical_columns + self._numeric_columns):
                  del df[col]
  
          # Convert categorical values into indices.
          for col_name, col_categories in zip(self._categorical_columns, categories):
              df[col_name] = df[col_name].apply(
                  lambda x: col_categories.index(str(x)) if str(x) in col_categories
                  else len(col_categories) - 1)
  
          # Make sure numeric values are really numeric
          for numeric_col in self._numeric_columns:
              df[numeric_col] = df[numeric_col].apply(lambda x: float(x))
  
          return df.as_matrix(self._categorical_columns + self._numeric_columns)