Skip to content

Commit

Permalink
refactor: store only unique values in _column_names dict
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Apr 18, 2023
1 parent 43d7d5d commit b1856b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/safeds/data/tabular/transformation/_one_hot_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def fit(self, table: Table, column_names: list[str] | None = None) -> OneHotEnco
result = OneHotEncoder()
result._wrapped_transformer = wrapped_transformer
result._column_names = {
column: [f"{column}_{element}" for element in table.get_column(column)] for column in column_names
column: [f"{column}_{element}" for element in table.get_column(column).get_unique_values()]
for column in column_names
}

return result
Expand Down

0 comments on commit b1856b1

Please sign in to comment.