# Should I scale data before or after balancing dataset?

I have 3 datasets which I each split into 3 separate classes [Buy/hold/sell]. I randomly up-sample each class's frequency in each dataset to 10,000 data points each.

My question is, should I scale the training set before I do random up-sampling, or afterwards? Does it somehow skew the final training set in some way?

I have provided a function which balances each dataset for me, note that at this point, the data has already been scaled.

def balance_dataset(df):
training_set = df[:round(len(df.values) * TRAINING_LENGTH)]

label_frequencies = training_set['Label'].value_counts(sort = True, ascending = True)

highest_occurence = resample(training_set[training_set['Label'] == label_frequencies.index[2]], n_samples = 10000, random_state = 0, replace = True)
middle_occurence = resample(training_set[training_set['Label'] == label_frequencies.index[1]], n_samples = 10000, random_state = 0, replace = True)
lowest_occurrence = resample(training_set[training_set['Label'] == label_frequencies.index[0]], n_samples = 10000, random_state = 0, replace = True)

balanced_training_set = pd.concat([highest_occurence, middle_occurence, lowest_occurrence])

return balanced_training_set[['MACD', 'MFI', 'ROC', 'RSI', 'Ultimate Oscillator', 'Williams %R', 'Awesome Oscillator', 'KAMA',