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: Fix multi-index on columns with bool level values does not roundtrip through parquet #60519

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

Conversation

sunlight798
Copy link
Contributor

@sunlight798 sunlight798 commented Dec 7, 2024

Comment on lines +128 to +134
if arr.dtype == object and dtype == bool:
# If the dtype is bool and the array is object, we need to replace
# the False and True of the object type in the ndarray with the
# bool type to ensure that the type conversion is correct
arr[arr == "False"] = np.False_
arr[arr == "True"] = np.True_
return arr.astype(dtype, copy=copy)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should be changing the behavior of astype(bool) to special case certain values.

Copy link
Contributor Author

@sunlight798 sunlight798 Dec 8, 2024

Choose a reason for hiding this comment

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

I got it. I think the method you mentioned in 60508 is quite reasonable. Thank you for your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: multi-index on columns with bool level values does not roundtrip through parquet
2 participants