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)

        Fit all fittable transformers in pipeline.

        Parameters
        ----------
        data
            (`Sequence` of) `TimeSeries` to fit on.
        
darts/dataprocessing/pipeline.py