docstr: Extract the data dictionary from a feature dataframe, and store it
  
  @param X: Input dataframe
  @param values: A dict mapping column name to a list of possible categorical values. It will be inferred from X if not provided.
docstr_tok: ["Extract","the","data","dictionary","from","a","feature","dataframe",",","and","store","it","@","param","X",":","Input","dataframe","@","param","values",":","A","dict","mapping","column","name","to","a","list","of","possible","categorical","values",".","It","will","be","inferred","from","X","if","not","provided","."]
code: def load_data_dictionary(self, X: pd.DataFrame, values: Dict = None):
      """
      Extract the data dictionary from a feature dataframe, and store it
  
      @param X: Input dataframe
      @param values: A dict mapping column name to a list of possible categorical values. It will be inferred from X if not provided.
      """
      dtypes = X.dtypes
      data_fields = []
      for index, value in dtypes.items():
          vals = None
          if np.issubdtype(value, np.integer):
              data_type = models.DataType.integer
              op_type = models.OpType.ordinal
          elif np.issubdtype(value, np.double):
              data_type = models.DataType.double
              op_type = models.OpType.continuous
          elif np.issubdtype(value, np.floating):
              data_type = models.DataType.float
              op_type = models.OpType.continuous
          elif np.issubdtype(value, np.bool_):
              data_type = models.DataType.boolean
              op_type = models.OpType.categorical
          else:
              data_type = models.DataType.string
              op_type = models.OpType.categorical
              vals = (
                  values[index]
                  if values is not None and index in values
                  else list(X[index].unique())
              )
          wrapped_vals = (
              list(map(lambda v: Value(v), vals))
              if vals is not None
              else vals
          )
          data_fields.append(
              models.DataField(
                  name=str(index),
                  optype=op_type,
                  dataType=data_type,
                  values=wrapped_vals,
              )
          )
      self._data_dictionary = models.DataDictionary(data_fields)
  
file_path: AIX360/aix360/algorithms/rule_induction/trxf/pmml_export/reader/trxf_reader.py
imports: from typing import Dict
  import numpy
  import pandas
  from aix360.algorithms.rule_induction.trxf.classifier import ruleset_classifier
  from aix360.algorithms.rule_induction.trxf.classifier.ruleset_classifier import RuleSetClassifier
  from aix360.algorithms.rule_induction.trxf.core import Conjunction, Relation
  from aix360.algorithms.rule_induction.trxf.pmml_export import models
  from aix360.algorithms.rule_induction.trxf.pmml_export.models.data_dictionary import Value
  from aix360.algorithms.rule_induction.trxf.pmml_export.reader import AbstractReader
  from aix360.algorithms.rule_induction.trxf.pmml_export.models import SimplePredicate, Operator, CompoundPredicate, BooleanOperator
label_desc: Use image node_id 4 for calling the TrxfReader obj's underlying member method code with example usage: obj.load_data_dictionary(X, values) without return types