diff --git a/cobra/preprocessing/preprocessor.py b/cobra/preprocessing/preprocessor.py index 3cd94c8..0177e34 100644 --- a/cobra/preprocessing/preprocessor.py +++ b/cobra/preprocessing/preprocessor.py @@ -227,6 +227,9 @@ def fit(self, train_data: pd.DataFrame, continuous_vars: list, log.info("Starting to fit pipeline") start = time.time() + # Ensure to operate on separate copy of data + train_data = train_data.copy() + # Fit discretizer, categorical preprocessor & target encoder # Note that in order to fit target_encoder, we first have to transform # the data using the fitted discretizer & categorical_data_processor