Skip to content

DOCS: fix category docs #51579

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

Merged
merged 5 commits into from
Feb 24, 2023
Merged

DOCS: fix category docs #51579

merged 5 commits into from
Feb 24, 2023

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Feb 23, 2023

The docs state that

all instances of CategoricalDtype compare equal to a CategoricalDtype(None, False),

which isn't true, e.g.:

>>> import pandas as pd
>>> c1 = pd.CategoricalDtype(["a", "b"])
>>> c1 == pd.CategoricalDtype(None, False)
False
>>> c1 == pd.CategoricalDtype()
False

Users should just compare like they already do, likely c1 == "category" or isinstance(c1, pd.CategoricalDtype).

@@ -1177,6 +1177,7 @@ Categorical
- Bug in :meth:`Series.replace` with categorical dtype losing nullable dtypes of underlying categories (:issue:`49404`)
- Bug in :meth:`DataFrame.groupby` and :meth:`Series.groupby` would reorder categories when used as a grouper (:issue:`48749`)
- Bug in :class:`Categorical` constructor when constructing from a :class:`Categorical` object and ``dtype="category"`` losing ordered-ness (:issue:`49309`)
- The :ref:`CategoricalDtype docs <categorical.categoricaldtype>` wrongly said that any :class:`CategoricalDtype` instance compared equal to ``CategoricalDtype(None, False)``. This statement has been corrected (:issue:`51579`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don't add a whatsnew note for doc changes. Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess not, considering #51579. I'll remove it.

@mroeschke mroeschke added this to the 2.1 milestone Feb 24, 2023
@mroeschke mroeschke merged commit 8974ce6 into pandas-dev:main Feb 24, 2023
@mroeschke
Copy link
Member

Thanks @topper-123

@topper-123 topper-123 deleted the category_docs branch February 24, 2023 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: CategoricalDtype(None, False) does not equals to category dtype
3 participants