Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order in which transformers are returned #1239

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sdv/single_table/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ def get_transformers(self):
"Use 'auto_assign_transformers' or 'fit' to create them."
)

field_transformers = {
column_name: field_transformers.get(column_name)
for column_name in self.metadata._columns
}

return field_transformers

def get_info(self):
Expand Down
8 changes: 6 additions & 2 deletions tests/unit/single_table/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,18 @@ def test_get_transformers(self):
'name': 'FrequencyEncoder',
'salary': 'FloatFormatter'
}
instance.metadata._columns = {
'salary': {'sdtype': 'numerical'},
'name': {'sdtype': 'categorical'}
}

# Run
result = BaseSingleTableSynthesizer.get_transformers(instance)

# Assert
assert result == {
'name': 'FrequencyEncoder',
'salary': 'FloatFormatter'
'salary': 'FloatFormatter',
'name': 'FrequencyEncoder'
}

def test_get_transformers_raises_an_error(self):
Expand Down