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

Update the return dtype of boolean transformer #247

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 6 additions & 1 deletion rdt/transformers/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ def reverse_transform(self, data):

data = pd.Series(data)

return np.round(data).clip(0, 1).astype('boolean').astype('object')
try:
out = np.round(data).clip(0, 1).astype('boolean').astype('bool')
except ValueError:
out = np.round(data).clip(0, 1).astype('boolean').astype('object')

return out
1 change: 0 additions & 1 deletion tests/integration/test_hyper_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def get_input_data_without_nan():
'names': ['Jon', 'Arya', 'Jon', 'Jon'],
})
data['datetime'] = pd.to_datetime(data['datetime'])
data['bool'] = data['bool'].astype('O') # boolean transformer returns O instead of bool

return data

Expand Down