code: def ord2num(data: np.ndarray, dist: dict) -> np.ndarray:
      """
      Transform categorical into numerical values using a mapping.
  
      Parameters
      ----------
      data
          Numpy array with the categorical data.
      dist
          Dict with as keys the categorical variables and as values
          the numerical value for each category.
  
      Returns
      -------
      Numpy array with transformed categorical data into numerical values.
      """
      rng = data.shape[0]
      X = data.astype(np.float32, copy=True)
      for k, v in dist.items():
          cat_col = X[:, k].copy()
          cat_col = np.array([v[int(cat_col[i])] for i in range(rng)])
          if isinstance(X, np.matrix):
              X[:, k] = cat_col.reshape(-1, 1)
          else:
              X[:, k] = cat_col
      return X.astype(np.float32)
  
imports: import numpy
  from typing import Tuple, List
label_desc: Use image node_id 2 for calling a global function with example usage: ord2num(data, dist) and returns: X