for index in range(len(values_names)): name = values_names[index] df = values_dfs[index] cols = df.columns.values new_cols = [ x for x in cols if x not in ['Date', 'USD', 'Value', 'Open', 'Close', 'High', 'Low', 'Volume'] ] new_cols2 = [x for x in cols if x not in ['Date']] dict_dfs_cols[name] = new_cols dict_dfs_cols2[name] = new_cols2 dataset = ml_dataset.generate_df_dataset(values_names, values_dfs, dict_dfs_cols) dataset_all = ml_dataset.generate_df_dataset(values_names, values_dfs, dict_dfs_cols2) #First 30 row dataset = dataset[31:] dataset = dataset.reset_index(drop=True) #colsToShift = [col for col in dataset.columns if 'HSI' in col or'N225' in col or'AXJO' in col] #dataset[colsToShift] = dataset[colsToShift].shift(-1) #last_row = dataset.shape[0]-1 #dataset = dataset.drop(last_row, axis=0) dataset_all = dataset_all[31:] dataset_all = dataset_all.reset_index(drop=True) #dataset_all[colsToShift] = dataset_all[colsToShift].shift(-1) #last_row = dataset_all.shape[0]-1
values_cols = ['USD', 'Value', 'Open', 'Close', 'High', 'Low', 'Volume'] dict_dfs_cols = {} dict_dfs_cols2 = {} for index in range(len(values_names)): name = values_names[index] df = values_dfs[index] cols = df.columns.values new_cols = [x for x in cols if x not in ['Date', 'USD', 'Value', 'Open', 'Close', 'High', 'Low', 'Volume']] new_cols2 = [x for x in cols if x not in ['Date']] dict_dfs_cols[name] = new_cols dict_dfs_cols2[name] = new_cols2 dataset = ml_dataset.generate_df_dataset(values_names, values_dfs, dict_dfs_cols) dataset_all = ml_dataset.generate_df_dataset(values_names, values_dfs, dict_dfs_cols2) #First 30 row dataset = dataset[31:] dataset = dataset.reset_index(drop=True) #colsToShift = [col for col in dataset.columns if 'HSI' in col or'N225' in col or'AXJO' in col] #dataset[colsToShift] = dataset[colsToShift].shift(-1) #last_row = dataset.shape[0]-1 #dataset = dataset.drop(last_row, axis=0) dataset_all = dataset_all[31:] dataset_all = dataset_all.reset_index(drop=True) #dataset_all[colsToShift] = dataset_all[colsToShift].shift(-1)