code: def fit_one_hot_encoders(X: np.ndarray) -> Dict[int, OneHotEncoder]:
      """Fits one-hot encoders to each categorical column in X. A categorical input needs to be a string, i.e. a
      categorical column consists only of strings.
  
      :param X: Input data matrix.
      :return: Dictionary that maps a column index to a scikit OneHotEncoder.
      """
      X = shape_into_2d(X)
  
      one_hot_encoders = {}
      for column in range(X.shape[1]):
          if is_categorical(X[:, column]):
              one_hot_encoders[column] = OneHotEncoder(
                  handle_unknown="ignore"
              )
              one_hot_encoders[column].fit(X[:, column].reshape(-1, 1))
  
      return one_hot_encoders
  
imports: import random
  from typing import Dict, Optional, Union
  import numpy
  from scipy.optimize import minimize
  from sklearn.preprocessing import OneHotEncoder
  from dowhy.gcm.util.catboost_encoder import CatBoostEncoder
label_desc: Use image node_id 5 for calling a global function with example usage: fit_one_hot_encoders(X) and returns: one_hot_encoders