-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add notice and example for CategoricalDtype
with different categories_dtype
#57273
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
Conversation
Thanks @luke396 ! I was hoping that this part would be edited: Two instances of :class:`~pandas.api.types.CategoricalDtype` compare equal
whenever they have the same categories and order. When comparing two
unordered categoricals, the order of the ``categories`` is not considered. to be a complete and definitive definition, covering all cases right here. (instead of adding examples and having the user then guess the actual rules) |
More generally, I am confused: A categorical's type is fully described by
1. ``categories``: a sequence of unique values and no missing values
2. ``ordered``: a boolean ... If the These should be good precise definitions giving an accurate conceptual understanding. |
Thank you, @VladimirFokow, for your advice on the PR. I hadn't considered it as thoroughly as you did. At the moment, the example in the file doesn't suit my needs well, which is why the PR is still in progress. Have to admit it, I actually don't have the same accurate and comprehensive understanding of
You've shown great consideration in enhancing the docstring, and your insights could be used to open a new pull request aimed at improving the general description further. |
Maybe they meant that a How is this dtype determined - completely disregarding the numpy dtype and just looking at the actual values? How to operate with it - can we change it / what are the best practices when dealing with problems connected to it) upd: Maybe what they meant here is a purely conceptual description, because after it they say:
|
Hi @rhshadrach, could you please review the PR and provide some comments for improvement? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
@rhshadrach Thanks for your prompt review! I have updated the PR based on your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/preview |
Website preview of this PR available at: https://pandas.pydata.org/preview/pandas-dev/pandas/57273/ |
Co-authored-by: Richard Shadrach <[email protected]>
Thanks @luke396 |
CategoricalDtype
equality semantics aren't completely described #57259 (Replace xxxx with the GitHub issue number)doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.