Open adriencrtr opened 2 months ago
Hi @adriencrtr the issue is actually that the cols must be list rather than a pandas column object. Column object should be supported though in the future, that'd be a useful addition. I'm leaving the issue open to remind myself of adding support for columns.
Also in the case at hand there are no columns of type object or bool. Hence the input is returned https://github.com/scikit-learn-contrib/category_encoders/blob/11fbba6520341e9b960d35dafd44704a67b5bafe/category_encoders/utils.py#L500-L501
Expected Behavior
Even if the
category_encoders.one_hot.OneHotEncoder
doesn't encode any features, we would expect it to convert a pd.DataFrame into a numpy.ndarray if we set the parameter :return_df=False
Actual Behavior
When the
category_encoders.one_hot.OneHotEncoder
deals with a dataframe with only numerical features, the parametercols
is empty and the parameterreturn_df=False
, thefit_transform
method returns a pd.DataFrame object.Steps to Reproduce the Problem
This works
Out: pandas.core.frame.DataFrame
This is the unexpected behavior
Out: numpy.ndarray
Specifications