class_docstr: Construct a transformer per data group. Splits data by groups from single or multiple columns and transforms
  remaining columns using the transformers corresponding to the groups.
  
  Parameters
  ----------
  transformer : scikit-learn compatible transformer
      The transformer to be applied per group.
  groups : int | str | List[int] | List[str] | None
      The column(s) of the array/dataframe to select as a grouping parameter set. If `None`, the transformer will be
      applied to the entire input without grouping.
  use_global_model : bool, default=True
      Whether or not to fall back to a general transformation in case a group is not found during `.transform()`.
  
  Attributes
  ----------
  transformers_ : scikit-learn compatible transformer | dict[..., scikit-learn compatible transformer]
      The fitted transformers per group or a single fitted transformer if `groups` is `None`.
  fallback_ : scikit-learn compatible transformer | None
      The fitted transformer to fall back to in case a group is not found during `.transform()`. Only present if
      `use_global_model` is `True`.
docstr: Fit one transformer for each group of training data `X`.
  
  Will also learn the groups that exist within the dataset.
  
  If `use_global_model=True` a fallback transformer will be fitted on the entire dataset in case a group is not
  found during `.transform()`.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      Training data. If `groups` is not `None`, X should have at least two columns, of which at least one
      corresponds to groups defined in `groups`, and the remaining columns represent the values to transform.
  y : array-like of shape (n_samples,), default=None
      Target values.
  
  Returns
  -------
  self : GroupedTransformer
      The fitted transformer.
docstr_tok: ["Fit","one","transformer","for","each","group","of","training","data","`","X","`",".","Will","also","learn","the","groups","that","exist","within","the","dataset",".","If","`","use_global_model=True","`","a","fallback","transformer","will","be","fitted","on","the","entire","dataset","in","case","a","group","is","not","found","during","`",".transform","(",")","`",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","Training","data",".","If","`","groups","`","is","not","`","None","`",",","X","should","have","at","least","two","columns",",","of","which","at","least","one","corresponds","to","groups","defined","in","`","groups","`",",","and","the","remaining","columns","represent","the","values","to","transform",".","y",":","array-like","of","shape","(","n_samples",",",")",",","default=None","Target","values",".","Returns","--","--","--","-","self",":","GroupedTransformer","The","fitted","transformer","."]
code: def fit(self, X, y=None):
      """Fit one transformer for each group of training data `X`.
  
      Will also learn the groups that exist within the dataset.
  
      If `use_global_model=True` a fallback transformer will be fitted on the entire dataset in case a group is not
      found during `.transform()`.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Training data. If `groups` is not `None`, X should have at least two columns, of which at least one
          corresponds to groups defined in `groups`, and the remaining columns represent the values to transform.
      y : array-like of shape (n_samples,), default=None
          Target values.
  
      Returns
      -------
      self : GroupedTransformer
          The fitted transformer.
      """
      self.__check_transformer()
  
      self.fallback_ = None
  
      if self.groups is None:
          self.transformers_ = clone(self.transformer).fit(X, y)
          return self
  
      X_group, X_value = _split_groups_and_values(
          X, self.groups, **self._check_kwargs
      )
      self.transformers_ = self.__fit_grouped_transformer(
          X_group, X_value, y
      )
  
      if self.use_global_model:
          self.fallback_ = clone(self.transformer).fit(X_value)
  
      return self
  
file_path: scikit-lego/sklego/meta/grouped_transformer.py
imports: import numpy
  import pandas
  from sklearn.base import BaseEstimator, TransformerMixin, clone
  from sklearn.utils.validation import check_is_fitted
  from sklego.meta._grouped_utils import _split_groups_and_values
label_desc: Use image node_id 5 for calling the GroupedTransformer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self, self