docstr: Fit all fittable transformers in pipeline.
  
  Parameters
  ----------
  data
      (`Sequence` of) `TimeSeries` to fit on.
docstr_tok: ["Fit","all","fittable","transformers","in","pipeline",".","Parameters","--","--","--","--","--","data","(","`","Sequence","`","of",")","`","TimeSeries","`","to","fit","on","."]
code: def fit(self, data: Union[TimeSeries, Sequence[TimeSeries]]):
      """
      Fit all fittable transformers in pipeline.
  
      Parameters
      ----------
      data
          (`Sequence` of) `TimeSeries` to fit on.
      """
  
      # Find the last fittable transformer index
      # No need to fit (and thus transform) after this index, possibly saving a fair bit of time
      last_fittable_idx = -1
      for idx, transformer in enumerate(self._transformers):
          if isinstance(transformer, FittableDataTransformer):
              last_fittable_idx = idx
  
      for idx, transformer in enumerate(self._transformers):
          if idx <= last_fittable_idx and isinstance(
              transformer, FittableDataTransformer
          ):
              transformer.fit(data)
  
          if idx < last_fittable_idx:
              data = transformer.transform(data)
  
file_path: darts/darts/dataprocessing/pipeline.py
imports: from copy import deepcopy
  from typing import Iterator, Sequence, Union
  from darts import TimeSeries
  from darts.dataprocessing.transformers import BaseDataTransformer, FittableDataTransformer, InvertibleDataTransformer
  from darts.logging import get_logger, raise_if_not
label_desc: Use image node_id 2 for calling the Pipeline obj's underlying member method code with example usage: obj.fit(data) without return types