Boolean with category - common type TypeError
LarsChrWiik opened this issue · 2 comments
Hi,
I can see that if I have a dataframe with a boolean column together with a categorical column, I get an error when using MCA.
TypeError: can't get common type for non-numeric array
I was wondering if this is expected behavior. Is boolean not supported?
I initially tried FAMD, but it seems that boolean is recognized as a categorical column rather than a numeric, which is why I am using MCA.
A minimal reproduce would be something like this:
import pandas as pd
import prince
df = pd.DataFrame.from_dict({
'col1': ["A", "B", "C"],
'col2': [True, True, False]
})
prince.MCA().fit_transform(df)
Hi, to my best knowledge, you should consider a booelan vector composed of 0 and 1 values, instead of True and False values.
Hello there 👋
I apologise for not answering earlier. I was not maintaining Prince anymore. However, I have just refactored the entire codebase. This refactoring should have fixed many bugs.
I don’t have time and energy to check if this fixes your issue, but there is a good chance it does. Feel free to reopen this issue if the problem persists after installing the new version — that is, version 0.8.0 and onwards.