-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CategoricalDtype.update_dtype fails with Categorical #27338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looking at the base implementation: pandas/pandas/core/dtypes/base.py Lines 232 to 269 in 5a7a8e1
there is a (personally I don't really like this polymorphism, I think it would be cleaner to just allow dtype objects and have the called to |
cc @jschendel |
I think only accepting |
Anything to do here for 1.0, or OK to push? |
FWIW, on master, this does succeed In [31]: pd.CategoricalDtype(['a']).update_dtype(pd.Categorical(['b'], ordered=True))
Out[31]: CategoricalDtype(categories=['b'], ordered=True) |
Could use a test for the behavior above. |
@mroeschke Is this up for grabs. If it is I'd like to work on it |
take |
ref #27318 (comment) it appears that CategoricalDtype might want to accept a Categorical as an argument but fails to handle that properly. Not sure intent here but we either want to fix to allow Categorical or alternately simplify and only allow
str/CategoricalDtype
inputThe text was updated successfully, but these errors were encountered: