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
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 parameter cols is empty and the parameter return_df=False, the fit_transform method returns a pd.DataFrame object.
Steps to Reproduce the Problem
import numpy as np
import pandas as pd
from category_encoders.one_hot import OneHotEncoder
rng = np.random.RandomState(42)
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
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
The text was updated successfully, but these errors were encountered: