Skip to content

BUG: Fix TypeError in assert_index_equal when comparing CategoricalIndex with check_categorical=True and exact=False #61941

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Aniketsy
Copy link

#61935

  • Fixes a bug where assert_index_equal raises a TypeError instead of AssertionError when comparing two CategoricalIndex objects with check_categorical=True and exact=False.

  • Ensures consistency with expected testing behavior by properly raising an AssertionError in these cases.

Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.

@Aniketsy
Copy link
Author

Hi @mroeschke
I've opened a pull request addressing
BUG: Fix TypeError in assert_index_equal when comparing CategoricalIndex with check_categorical=True and exact=False ([#61941])
The changes are ready for review.

I'd really appreciate it if you could take a look and provide feedback .
Please let me know if anything needs to be improved or clarified.

Thanks!

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Jul 25, 2025
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

This also needs a unit test

@Aniketsy Aniketsy force-pushed the bugfix-assert-categoricalindex-typeerror branch from 333eb89 to 5edf8ce Compare July 25, 2025 18:06
@Aniketsy
Copy link
Author

Hi @mroeschke,

Thank you for your review. I’ve updated the PR based on your feedback ,please have a look when convenient.

Additionally, I noticed one check failure (pre-commit.ci-pr) and wanted to ask if you could help clarify the reason behind it. Apologies if this isn't the appropriate way to raise this, please do let me know the correct approach if needed.

Thanks again!

@Aniketsy Aniketsy force-pushed the bugfix-assert-categoricalindex-typeerror branch from de5b16b to 08739f2 Compare July 26, 2025 10:38
@Aniketsy
Copy link
Author

Checks fail

Hi @jorisvandenbossche, I ran pre-commit locally and all hooks passed. However, the GitHub checks are still showing a failure. Could you please advise if I’ve missed something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants