From 2cdb00967d0af3ff4977060d9806e4f875b2be7a Mon Sep 17 00:00:00 2001 From: a-szulc Date: Mon, 2 Sep 2024 15:34:10 +0200 Subject: [PATCH] change X.iloc[:, 1] to X[column_name] so there is no warning from pandas --- supervised/algorithms/catboost.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/supervised/algorithms/catboost.py b/supervised/algorithms/catboost.py index f7c52882..1232acfe 100644 --- a/supervised/algorithms/catboost.py +++ b/supervised/algorithms/catboost.py @@ -198,9 +198,10 @@ def fit( for i in range(X.shape[1]): if PreprocessingUtils.is_categorical(X.iloc[:, i]): self.cat_features += [i] - X.iloc[:, i] = X.iloc[:, i].astype(str) + col_name = X.columns[i] + X[col_name] = X[col_name].astype(str) if X_validation is not None: - X_validation.iloc[:, i] = X_validation.iloc[:, i].astype(str) + X_validation[col_name] = X_validation[col_name].astype(str) eval_set = None if X_validation is not None and y_validation is not None: