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
I'd expect this level should contain all categories: CategoricalIndex(['x', 'y', 'z'], categories=['x', 'y', 'z'], ...) - even if 'z' is not used. If it had then the both outputs of make_axis_dummies would be as in Out[10].
jreback
changed the title
Inconsistency in make_axis_dummies (and/or Panel.to_frame()) with categorical index level
BUG: Inconsistency in make_axis_dummies (and/or Panel.to_frame()) with categorical index level
Aug 17, 2016
@jreback have you seen any progress or thought on this issue? I agree with @pijucha that the high level .get_dummies() API should create dummy columns based on the categories themselves, which may include levels not represented in the data, rather than the categories only represented in the data.
I'm happy to work on a PR if the maintainers agree.
make_axis_dummies is essentially a private function and Panel has been removed. Not sure if there's any further things to address in this issue. Feel free to reopen if so.
make_axis_dummies
has some problems with an axis containing aCategoricalIndex
with extra categories.Code Sample, a copy-pastable example if possible
Expected Output
I believe
make_axis_dummies(ldf)
andmake_axis_dummies(ldf, transform=lambda x: x)
should be equal.output of
pd.show_versions()
In fact, this may be an issue with
Panel.to_frame()
rather thanmake_axis_dummies
:I'd expect this level should contain all categories:
CategoricalIndex(['x', 'y', 'z'], categories=['x', 'y', 'z'], ...)
- even if'z'
is not used. If it had then the both outputs ofmake_axis_dummies
would be as inOut[10]
.(Somewhat related to #13854.)
The text was updated successfully, but these errors were encountered: