-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Fix error value_counts
result with pyarrow categorical columns
#60949
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
Changes from 3 commits
1e4e2f4
c9282de
a4ad466
4f79b07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -447,7 +447,12 @@ def __init__( | |||||||||||||||
if isinstance(values.dtype, ArrowDtype) and issubclass( | ||||||||||||||||
values.dtype.type, CategoricalDtypeType | ||||||||||||||||
): | ||||||||||||||||
arr = values._pa_array.combine_chunks() | ||||||||||||||||
from pandas import Index | ||||||||||||||||
|
||||||||||||||||
if isinstance(values, Index): | ||||||||||||||||
arr = values._data._pa_array.combine_chunks() | ||||||||||||||||
else: | ||||||||||||||||
arr = values._pa_array.combine_chunks() | ||||||||||||||||
Comment on lines
+450
to
+455
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mroeschke Thanks for review. After applied this change got failed of 2 testcase in Following is error message from 2 fail testcase,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah ok. It appears something is passing in an |
||||||||||||||||
categories = arr.dictionary.to_pandas(types_mapper=ArrowDtype) | ||||||||||||||||
codes = arr.indices.to_numpy() | ||||||||||||||||
dtype = CategoricalDtype(categories, values.dtype.pyarrow_dtype.ordered) | ||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.