Skip to content

Commit

Permalink
Update src/safeds/data/tabular/containers/_tagged_table.py
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Breuer <[email protected]>
  • Loading branch information
zzril and sibre28 authored Jul 8, 2023
1 parent 0db7131 commit ff3782b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/safeds/data/tabular/containers/_tagged_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,11 @@ def keep_only_columns(self, column_names: list[str]) -> TaggedTable:
raise IllegalSchemaModificationError("Must keep the target column.")
if len(set(self.features.column_names).intersection(set(column_names))) == 0:
raise IllegalSchemaModificationError("Must keep at least one feature column.")
table = super().keep_only_columns(column_names)
return TaggedTable._from_table(
table,
super().keep_only_columns(column_names),
target_name=self.target.name,
feature_names=sorted(
set(self.features.column_names).intersection(set(table.column_names)),
set(self.features.column_names).intersection(set(column_names)),
key={val: ix for ix, val in enumerate(self.features.column_names)}.__getitem__,
),
)
Expand Down

0 comments on commit ff3782b

Please sign in to comment.