def transform(
        self,
        data: Union[TimeSeries, Sequence[TimeSeries]],
        series_idx: Optional[Union[int, Sequence[int]]] = None,
    ) -> Union[TimeSeries, Sequence[TimeSeries]]:
        """
        For each data transformer in pipeline transform data. Then transformed data is passed to next transformer.

        Parameters
        ----------
        data
            (`Sequence` of) `TimeSeries` to be transformed.
        series_idx
            Optionally, the index(es) of each series corresponding to their positions within the series used to fit
            the transformer (to retrieve the appropriate transformer parameters).

        Returns
        -------
        Union[TimeSeries, Sequence[TimeSeries]]
            Transformed data.
        """
        for transformer in self._transformers:
            data = transformer.transform(data, series_idx=series_idx)
        return data

        For each data transformer in pipeline transform data. Then transformed data is passed to next transformer.

        Parameters
        ----------
        data
            (`Sequence` of) `TimeSeries` to be transformed.
        series_idx
            Optionally, the index(es) of each series corresponding to their positions within the series used to fit
            the transformer (to retrieve the appropriate transformer parameters).

        Returns
        -------
        Union[TimeSeries, Sequence[TimeSeries]]
            Transformed data.
        
darts/dataprocessing/pipeline.py