(self, y, array_like=True)
return y_transform
Transform new targets using the previously fit scaler.
        Also apply a logarithm or differencing if required for making the series stationary.

        array_like determines if y is expected to be multiple values or a single value.
        Note that the differencing won't be done if array_like=False.
Transform new targets using the previously fit scaler.
        Also apply a logarithm or differencing if required for making the series stationary.
Transform new targets using the previously fit scaler . Also apply a logarithm or differencing if required for making the series stationary .
def transform(self, y, array_like=True):
        """
        Transform new targets using the previously fit scaler.
        Also apply a logarithm or differencing if required for making the series stationary.

        array_like determines if y is expected to be multiple values or a single value.
        Note that the differencing won't be done if array_like=False.
        """

        y_transform = y      

        # Apply a logarithm to make the array stationary
        if self.make_stationary == 'log':
            y_transform = np.log(y)

        # Apply stationarity lags by differencing the array
        elif self.make_stationary == 'difference' and array_like:
            y_diff = y_transform.copy()
            len_y = len(y_diff)

            for i in range(max(self.lags), len_y):
                for lag in self.lags:
                    if isinstance(y_diff, (pd.Series, pd.DataFrame)):
                        y_diff.iloc[i] = y_diff.iloc[i] - y_transform.iloc[i - lag]
                    else:
                        y_diff[i] = y_diff[i] - y_transform[i - lag]
            
            # Remove targets with insufficient lag periods
            # NOTE: The corresponding samples will need to be dropped at this function call's origin
            if isinstance(y_diff, (pd.Series, pd.DataFrame)):
                y_transform = y_diff.iloc[max(self.lags):]
            else:
                y_transform = y_diff[max(self.lags):]

        # Scale the targets using the previously fit scaler
        if self.scale:
            y_transform_scaled = self.scaler_instance.transform(y_transform)
            
            if isinstance(y_transform, pd.DataFrame):
                # The scaler returns a numpy array which needs to be converted back to a data frame
                y_transform = pd.DataFrame(y_transform_scaled, columns=y_transform.columns, index=y_transform.index)

        if self.logfile is not None:
            self._print_log(1, data=y_transform, array_like=array_like)
        
        return y_transform
def transform ( self , y , array_like = True ) : y_transform = y # Apply a logarithm to make the array stationary if self . make_stationary == 'log' : y_transform = np . log ( y ) # Apply stationarity lags by differencing the array elif self . make_stationary == 'difference' and array_like : y_diff = y_transform . copy ( ) len_y = len ( y_diff ) for i in range ( max ( self . lags ) , len_y ) : for lag in self . lags : if isinstance ( y_diff , ( pd . Series , pd . DataFrame ) ) : y_diff . iloc [ i ] = y_diff . iloc [ i ] - y_transform . iloc [ i - lag ] else : y_diff [ i ] = y_diff [ i ] - y_transform [ i - lag ] # Remove targets with insufficient lag periods # NOTE: The corresponding samples will need to be dropped at this function call's origin if isinstance ( y_diff , ( pd . Series , pd . DataFrame ) ) : y_transform = y_diff . iloc [ max ( self . lags ) : ] else : y_transform = y_diff [ max ( self . lags ) : ] # Scale the targets using the previously fit scaler if self . scale : y_transform_scaled = self . scaler_instance . transform ( y_transform ) if isinstance ( y_transform , pd . DataFrame ) : # The scaler returns a numpy array which needs to be converted back to a data frame y_transform = pd . DataFrame ( y_transform_scaled , columns = y_transform . columns , index = y_transform . index ) if self . logfile is not None : self . _print_log ( 1 , data = y_transform , array_like = array_like ) return y_transform