Skip to content

Commit

Permalink
dataframe: fix anonymous columns derive error
Browse files Browse the repository at this point in the history
Signed-off-by: mgqa34 <mgq3374541@163.com>
Signed-off-by: weiwee <wbwmat@gmail.com>
  • Loading branch information
mgqa34 authored and sagewe committed Jul 21, 2023
1 parent 6a78969 commit 47857d4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions python/fate/arch/dataframe/manager/schema_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,16 @@ def derive_new_schema_manager(self, with_sample_id=True, with_match_id=True,
columns = [columns]

column_set = set(columns)
new_columns = []
new_anonymous_columns = []
derived_columns = []
derived_anonymous_columns = []
for column, anonymous_column in zip(self._schema.columns, self._schema.anonymous_columns):
if column not in column_set:
continue
new_columns.append(column)
new_anonymous_columns.append(anonymous_column)
derived_schema.columns = self._schema.columns[self._schema.columns.get_indexer(columns)]
derived_schema.anonymous_columns = self._schema.columns[self._schema.anonymous_columns.get_indexer(columns)]
derived_columns.append(column)
derived_anonymous_columns.append(anonymous_column)

derived_schema.columns = pd.Index(derived_columns)
derived_schema.anonymous_columns = pd.Index(derived_anonymous_columns)

derived_schema_manager.schema = derived_schema
derived_schema_manager.init_name_mapping()
Expand Down

0 comments on commit 47857d4

Please sign in to comment.