Skip to content

BUG: Allow plain bools in ExtensionArray.equals #34661

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

Merged
merged 3 commits into from
Jun 9, 2020

Conversation

xhochy
Copy link
Contributor

@xhochy xhochy commented Jun 9, 2020

@jorisvandenbossche jorisvandenbossche added Bug ExtensionArray Extending pandas with custom dtypes or arrays. labels Jun 9, 2020
@jorisvandenbossche jorisvandenbossche added this to the 1.1 milestone Jun 9, 2020
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me!

@@ -29,6 +29,10 @@ def data_missing():
return ArrowBoolArray.from_scalars([None, True])


def test_basic_equals(data):
assert pd.Series(data).equals(pd.Series(data))
Copy link
Member

Choose a reason for hiding this comment

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

There is a BaseMethodsTests test_equals that could in theory be reused here. But since none of the other methods are implemented, we would need to skip all other tests, which would be a bit onerous. So fine with a custom test.

return (equal_values | equal_na).all().item()
result = (equal_values | equal_na).all()

if isinstance(result, np.bool_):
Copy link
Contributor

Choose a reason for hiding this comment

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

bool(result) should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed and CI passed.

@jorisvandenbossche jorisvandenbossche merged commit 8417b4b into pandas-dev:master Jun 9, 2020
@jorisvandenbossche
Copy link
Member

Thanks!

@xhochy xhochy deleted the gh-34660 branch June 9, 2020 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: ExtensionArray.equals expects ExtensionArray.all to return a numpy.bool_
3 participants