Skip to content

Conversation

TomAugspurger
Copy link
Contributor

The original issue was already fixed. I added tests to verify (but no whatsnew entry).

This addes tests and a fix for #16603 (comment) about Categorical.equals

Closes #16603

@gfyoung gfyoung added API Design Categorical Categorical Data Type labels Dec 18, 2017
@codecov
Copy link

codecov bot commented Dec 18, 2017

Codecov Report

Merging #18822 into master will decrease coverage by <.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18822      +/-   ##
==========================================
- Coverage   91.56%   91.56%   -0.01%     
==========================================
  Files         150      150              
  Lines       48942    48947       +5     
==========================================
+ Hits        44816    44820       +4     
- Misses       4126     4127       +1
Flag Coverage Δ
#multiple 89.93% <66.66%> (-0.01%) ⬇️
#single 41.74% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/categorical.py 95.8% <66.66%> (-0.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04beec7...84b2640. Read the comment docs.

@jreback jreback added this to the 0.22.0 milestone Dec 19, 2017
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

small code comment.

if self.is_dtype_equal(other):
if self.categories.equals(other.categories):
# fastpath to avoid re-coding
return np.array_equal(self._codes, other._codes)
Copy link
Contributor

Choose a reason for hiding this comment

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

could make this slightly simper

if self.categories.equals(....):
      other_codes = other._codes
else:
     other_codes = _recode......
return np.array_equal(self._codes, other_codes)

The original issue was already fixed. I added tests to verify (but no whatsnew entry).

This addes tests and a fix for pandas-dev#16603 (comment) about `Categorical.equals`

Closes pandas-dev#16603
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

just a doc change, otherwise lgtm.

.. _whatsnew_0220:

v0.22.0
-------
Copy link
Contributor

Choose a reason for hiding this comment

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

revert this

^^^^^^^^^^^

-
- Bug in ``Categorical.equals`` between two unordered categories with the same categories, but in a different order (:issue:`16603`)
Copy link
Contributor

Choose a reason for hiding this comment

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

use :func: here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't list all the Categorical methods in the API docs, and .equals is one of the excluded ones.

@jreback
Copy link
Contributor

jreback commented Jan 1, 2018

rebase and push again, fixed some hanging by Travis CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Design Categorical Categorical Data Type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CategoricalIndex.equals incorrectly considers category order when unordered

3 participants