Skip to content

Commit ce16b23

Browse files
fix
1 parent 9812ace commit ce16b23

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

category_encoders/basen.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ def transform(self, X, override_return_df=False):
253253
X_out = self.basen_encode(X_out, cols=self.cols)
254254

255255
if self.drop_invariant:
256-
for col in self.drop_cols:
257-
X_out.drop(col, 1, inplace=True)
256+
X_out = X_out.drop(columns=self.drop_cols)
258257

259258
# impute missing values only in the generated columns
260259
# generated_cols = util.get_generated_cols(X, X_out, self.cols)

category_encoders/hashing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ def require_data(self, data_lock, new_start, done_index, hashing_parts, cols, pr
202202
# Always get df and check it after merge all data parts
203203
data_part = self.hashing_trick(X_in=data_part, hashing_method=self.hash_method, N=self.n_components, cols=self.cols)
204204
if self.drop_invariant:
205-
for col in self.drop_cols:
206-
data_part.drop(col, 1, inplace=True)
205+
data_part = data_part.drop(columns=self.drop_cols)
207206
part_index = int(math.ceil(end_index / self.max_sample))
208207
hashing_parts.put({part_index: data_part})
209208
if self.verbose == 5:

category_encoders/ordinal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ def transform(self, X, override_return_df=False):
209209
)
210210

211211
if self.drop_invariant:
212-
for col in self.drop_cols:
213-
)
212+
X = X.drop(columns=self.drop_cols)
214213

215214
if self.return_df or override_return_df:
216215
return X

0 commit comments

Comments
 (0)