(self, X, y=None)
Stationarize `X` by applying the procedure given by `operation`.

        Parameters
        ----------
        X : ndarray of shape (n_samples,) or (n_samples, ...)
            Input data.

        y : None
            There is no need for a target, yet the pipeline API requires this
            parameter.

        Returns
        -------
        Xt : ndarray of shape (n_samples_new, ...)
            Stationarized array. ``n_samples_new = n_samples - 1``.
Stationarize `X` by applying the procedure given by `operation`.
Stationarize X by applying the procedure given by operation .
def transform(self, X, y=None):
        """Stationarize `X` by applying the procedure given by `operation`.

        Parameters
        ----------
        X : ndarray of shape (n_samples,) or (n_samples, ...)
            Input data.

        y : None
            There is no need for a target, yet the pipeline API requires this
            parameter.

        Returns
        -------
        Xt : ndarray of shape (n_samples_new, ...)
            Stationarized array. ``n_samples_new = n_samples - 1``.

        """
        check_is_fitted(self, '_is_fitted')
        Xt = check_array(X, ensure_2d=False, allow_nd=True)

        if Xt.ndim == 1:
            Xt = Xt[:, None]

        if self.operation == 'return':
            return np.diff(Xt, n=1, axis=0) / Xt[1:]
        else:  # Assumes 'log-return' operation
            return np.diff(np.log(Xt), n=1, axis=0)
def transform ( self , X , y = None ) : check_is_fitted ( self , '_is_fitted' ) Xt = check_array ( X , ensure_2d = False , allow_nd = True ) if Xt . ndim == 1 : Xt = Xt [ : , None ] if self . operation == 'return' : return np . diff ( Xt , n = 1 , axis = 0 ) / Xt [ 1 : ] else : # Assumes 'log-return' operation return np . diff ( np . log ( Xt ) , n = 1 , axis = 0 )