Skip to content

Commit

Permalink
🐛 Patch the 'Category encoder bug'.
Browse files Browse the repository at this point in the history
  • Loading branch information
adriencrtrcap committed Sep 3, 2024
1 parent 574f3db commit 8ddc3dd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qolmat/analysis/holes_characterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ def _encode_dataframe(self, df: pd.DataFrame) -> np.ndarray:
The encoded DataFrame as a numpy ndarray, with numeric data concatenated
with one-hot encoded categorical and boolean data.
"""
if not df.select_dtypes(include=["object", "bool"]).columns.to_list():
return df.to_numpy()

if not self.encoder:
self.encoder = OneHotEncoder(
cols=df.select_dtypes(include=["object", "bool"]).columns,
Expand Down

0 comments on commit 8ddc3dd

Please sign in to comment.