from imblearn.over_sampling import SMOTE sm = SMOTE(random_state = 42) X_train_oversampled, y_train_oversampled = sm.fit_sample(X_train, y_train) X_train = pd.DataFrame(X_train_oversampled, columns=X_train.columns)