class_docstr: Implements an ML preprocessing operation.
  
  Preprocessors are stateful objects that can be fitted against a Dataset and used
  to transform both local data batches and distributed data. For example, a
  Normalization preprocessor may calculate the mean and stdev of a field during
  fitting, and uses these attributes to implement its normalization transform.
  
  Preprocessors can also be stateless and transform data without needed to be fitted.
  For example, a preprocessor may simply remove a column, which does not require
  any state to be fitted.
  
  If you are implementing your own Preprocessor sub-class, you should override the
  following:
  
  * ``_fit`` if your preprocessor is stateful. Otherwise, set
    ``_is_fittable=False``.
  * ``_transform_pandas`` and/or ``_transform_numpy`` for best performance,
    implement both. Otherwise, the data will be converted to the match the
    implemented method.
docstr: Fit this Preprocessor to the Dataset.
  
  Fitted state attributes will be directly set in the Preprocessor.
  
  Calling it more than once will overwrite all previously fitted state:
  ``preprocessor.fit(A).fit(B)`` is equivalent to ``preprocessor.fit(B)``.
  
  Args:
      ds: Input dataset.
  
  Returns:
      Preprocessor: The fitted Preprocessor with state attributes.
docstr_tok: ["Fit","this","Preprocessor","to","the","Dataset",".","Fitted","state","attributes","will","be","directly","set","in","the","Preprocessor",".","Calling","it","more","than","once","will","overwrite","all","previously","fitted","state",":","``","preprocessor.fit","(","A",")",".fit","(","B",")","``","is","equivalent","to","``","preprocessor.fit","(","B",")","``",".","Args",":","ds",":","Input","dataset",".","Returns",":","Preprocessor",":","The","fitted","Preprocessor","with","state","attributes","."]
code: def fit(self, ds: "Dataset") -> "Preprocessor":
      """Fit this Preprocessor to the Dataset.
  
      Fitted state attributes will be directly set in the Preprocessor.
  
      Calling it more than once will overwrite all previously fitted state:
      ``preprocessor.fit(A).fit(B)`` is equivalent to ``preprocessor.fit(B)``.
  
      Args:
          ds: Input dataset.
  
      Returns:
          Preprocessor: The fitted Preprocessor with state attributes.
      """
      fit_status = self.fit_status()
      if fit_status == Preprocessor.FitStatus.NOT_FITTABLE:
          # No-op as there is no state to be fitted.
          return self
  
      if fit_status in (
          Preprocessor.FitStatus.FITTED,
          Preprocessor.FitStatus.PARTIALLY_FITTED,
      ):
          warnings.warn(
              "`fit` has already been called on the preprocessor (or at least one "
              "contained preprocessors if this is a chain). "
              "All previously fitted state will be overwritten!"
          )
  
      fitted_ds = self._fit(ds)
      self._fitted = True
      return fitted_ds
  
imports: import abc
  import base64
  import collections
  import pickle
  import warnings
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Dict, Optional, Union
  from ray.air.util.data_batch_conversion import BatchFormat
  from ray.util.annotations import Deprecated, DeveloperAPI, PublicAPI
label_desc: Use image node_id 4 for calling the Preprocessor obj's underlying member method code with example usage: obj.fit(ds) and returns: fitted_ds, self