Skip to content
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

BUG: value_counts() check Index with PyArrow categorical columns #60569

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

Conversation

NOBODIDI
Copy link

@NOBODIDI NOBODIDI commented Dec 14, 2024

This is my first issue, thank you in advance for your patience and feedback!

Copy link
Member

@rhshadrach rhshadrach left a 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! Will need to add tests using the value_counts method too. The CI appears to be failing, I'd recommend merging main and see if it's still failing.

@@ -447,7 +447,10 @@ def __init__(
if isinstance(values.dtype, ArrowDtype) and issubclass(
values.dtype.type, CategoricalDtypeType
):
arr = values._pa_array.combine_chunks()
if values.__class__.__name__ == 'Index':
Copy link
Member

Choose a reason for hiding this comment

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

Use isinstance instead of checking the name.

values = Index(["a1", "a2"], dtype=ArrowDtype(pa.string()))
arr = values._data._pa_array.combine_chunks()

assert arr.equals(values._data._pa_array.combine_chunks())
Copy link
Member

Choose a reason for hiding this comment

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

What is this testing?

@rhshadrach rhshadrach added Bug Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Categorical Categorical Data Type Arrow pyarrow functionality labels Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Arrow pyarrow functionality Bug Categorical Categorical Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: value_counts() returns error/wrong result with PyArrow categorical columns with nulls
2 participants