code: def ohe2ord(
      X_ohe: np.ndarray, cat_vars_ohe: dict
  ) -> Tuple[np.ndarray, dict]:
      """
      Convert one-hot encoded variables to ordinal encodings.
  
      Parameters
      ----------
      X_ohe
          Data with mixture of one-hot encoded and numerical variables.
      cat_vars_ohe
          Dict with as keys the first column index for each one-hot encoded categorical variable
          and as values the number of categories per categorical variable.
  
      Returns
      -------
      Ordinal equivalent of one-hot encoded data and dict with categorical columns and number of categories.
      """
      n, cols = X_ohe.shape
      ohe_vars_keys = list(cat_vars_ohe.keys())
      X_list: List = []
      c = 0
      cat_vars_ord = {}
      while c < cols:
          if c in ohe_vars_keys:
              v = cat_vars_ohe[c]
              X_ohe_c = X_ohe[:, c : c + v]
              assert int(np.sum(X_ohe_c, axis=1).sum()) == n
              X_ord_c = np.argmax(X_ohe_c, axis=1)
              cat_vars_ord[len(X_list)] = v
              X_list.append(X_ord_c.reshape(n, 1))
              c += v
              continue
          X_list.append(X_ohe[:, c].reshape(n, 1))
          c += 1
      X_ord = np.concatenate(X_list, axis=1)
      return X_ord, cat_vars_ord
  
imports: import numpy
  from typing import Tuple, List
label_desc: Use image node_id 5 for calling a global function with example usage: ohe2ord(X_ohe, cat_vars_ohe) and returns: X_ord,  cat_vars_ord