code: def fit(
      self,
      X: PIPELINE_DATA_DTYPE,
      y: Optional[PIPELINE_DATA_DTYPE] = None,
  ) -> "TfidfEncoder":
      if self.analyzer == "word":
          ngram_range = self.ngram_range_word
      elif self.analyzer == "char":
          ngram_range = self.ngram_range_char
      else:
          raise KeyError(f"Analyzer is not defined for {self.analyzer}")
  
      self.sublinear_tf = check_for_bool(self.sublinear_tf)
      self.binary = check_for_bool(self.binary)
  
      if isinstance(X, pd.DataFrame):
          X.fillna("", inplace=True)
          if self.per_column:
              self.preprocessor = {}
  
              for feature in X.columns:
                  vectorizer = TfidfVectorizer(
                      ngram_range=(ngram_range, ngram_range),
                      min_df=self.min_df,
                      max_df=self.max_df,
                      binary=self.binary,
                      norm=self.norm,
                      sublinear_tf=self.sublinear_tf,
                      analyzer=self.analyzer,
                  ).fit(X[feature])
                  self.preprocessor[feature] = vectorizer
          else:
              self.preprocessor = TfidfVectorizer(
                  ngram_range=(ngram_range, ngram_range),
                  min_df=self.min_df,
                  max_df=self.max_df,
                  binary=self.binary,
                  norm=self.norm,
                  sublinear_tf=self.sublinear_tf,
                  analyzer=self.analyzer,
              )
              all_text = itertools.chain.from_iterable(
                  X[col] for col in X.columns
              )
              self.preprocessor = self.preprocessor.fit(all_text)
  
      else:
          raise ValueError(
              "Your text data is not encoded in a pandas.DataFrame\n"
              "Please make sure to use a pandas.DataFrame and ensure"
              "that the text features are encoded as strings."
          )
      return self
  
imports: from typing import Dict, Optional, Tuple, Union
  import itertools
  import ConfigSpace.hyperparameters
  import numpy
  import pandas
  from ConfigSpace import EqualsCondition
  from ConfigSpace.configuration_space import ConfigurationSpace
  from scipy.sparse import hstack
  from sklearn.feature_extraction.text import TfidfVectorizer
  from autosklearn.askl_typing import FEAT_TYPE_TYPE
  from autosklearn.pipeline.base import DATASET_PROPERTIES_TYPE, PIPELINE_DATA_DTYPE
  from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm
  from autosklearn.pipeline.constants import DENSE, INPUT, SPARSE, UNSIGNED_DATA
  from autosklearn.util.common import check_for_bool
label_desc: Use image node_id 2 for calling the TfidfEncoder obj's underlying member method code with example usage: obj.fit(X, y) and returns: self