You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OneHotEncoder transformer crashes if the dtype is 'category' similar to the LabelEncoder as described in #617. Certain synthesizers -- such as CTGANSynthesizer and TVAESynthesizer -- use One Hot Encoding, so this transformer error prevents them from being able to model this type of data.
Steps to reproduce
importpandasaspdfromrdt.transformers.categoricalimportOneHotEncoder# create some discrete data and store is as type 'category'test_data=pd.DataFrame(data={
'A': ['Yes', 'No', 'Yes', 'Maybe', 'No']
})
test_data['A'] =test_data['A'].astype('category')
# try to use one hot encodertransformer=OneHotEncoder()
transformed_data=transformer.fit_transform(test_data, column='A')
Output:
TypeError: Cannot interpret 'CategoricalDtype(categories=['Maybe', 'No', 'Yes'], ordered=False)' as a data type
Environment Details
Error Description
The
OneHotEncoder
transformer crashes if the dtype is'category'
similar to theLabelEncoder
as described in #617. Certain synthesizers -- such asCTGANSynthesizer
andTVAESynthesizer
-- use One Hot Encoding, so this transformer error prevents them from being able to model this type of data.Steps to reproduce
Output:
Stack Trace:
stack_trace.txt
The text was updated successfully, but these errors were encountered: