diff --git a/src/ydata_synthetic/preprocessing/timeseries/stock.py b/src/ydata_synthetic/preprocessing/timeseries/stock.py index 47c9ccdd..b2707d64 100644 --- a/src/ydata_synthetic/preprocessing/timeseries/stock.py +++ b/src/ydata_synthetic/preprocessing/timeseries/stock.py @@ -22,7 +22,8 @@ def transformations(seq_len: int): # Reading the stock data stock_df = pd.read_csv('../data/stock.csv') + stock_df = stock_df.set_index('Date').sort_index() #Data transformations to be applied prior to be used with the synthesizer model - processed_data = real_data_loading(stock_df, seq_len=seq_len) + processed_data = real_data_loading(stock_df.values, seq_len=seq_len) return processed_data diff --git a/src/ydata_synthetic/preprocessing/timeseries/utils.py b/src/ydata_synthetic/preprocessing/timeseries/utils.py index e5e315ba..c77c67b2 100644 --- a/src/ydata_synthetic/preprocessing/timeseries/utils.py +++ b/src/ydata_synthetic/preprocessing/timeseries/utils.py @@ -18,7 +18,8 @@ def real_data_loading(data: np.array, seq_len): # Flip the data to make chronological data ori_data = data[::-1] # Normalize the data - ori_data = MinMaxScaler(ori_data) + scaler = MinMaxScaler().fit(ori_data) + ori_data = scaler.transform(ori_data) # Preprocess the dataset temp_data = []