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
pd.get_dummies provides a way to turn a sequence of category-like data into a one-hot encoded data frame. However, there is no easy way (to my knowledge) of going in the other direction: given a boolean dataframe where the row sums are all 1, produce a categorical series. This task is particularly valuable for serialisation.
Describe the solution you'd like
Some way of constructing a Categorical array from a one-hot encoded dataframe (view). To avoid piling extra functionality into the existing constructor, a class method could be used.
Is your feature request related to a problem?
pd.get_dummies
provides a way to turn a sequence of category-like data into a one-hot encoded data frame. However, there is no easy way (to my knowledge) of going in the other direction: given a boolean dataframe where the row sums are all 1, produce a categorical series. This task is particularly valuable for serialisation.Describe the solution you'd like
Some way of constructing a
Categorical
array from a one-hot encoded dataframe (view). To avoid piling extra functionality into the existing constructor, a class method could be used.Scratch implementation:
Describe alternatives you've considered
Additional context
sklearn.preprocessing.OneHotEncoder.inverse_transform
The text was updated successfully, but these errors were encountered: