-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: .equals for Extension Arrays #30652
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 1 commit
36c8b88
786963c
6800315
a3e7b7f
860013f
fc3d2c2
3da5726
c5027dd
375664c
b6ad2fb
365362a
aae2f94
8d052ad
9ee034e
38501e6
dccec7f
0b1255f
b8be858
4c7273f
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 |
---|---|---|
|
@@ -335,7 +335,7 @@ def __iter__(self): | |
for i in range(len(self)): | ||
yield self[i] | ||
|
||
def __eq__(self, other: Any) -> ArrayLike: | ||
def __eq__(self, other: Any) -> ArrayLike: # type: ignore[override] # NOQA | ||
""" | ||
Return for `self == other` (element-wise equality). | ||
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. I think we should have some guidance here that if 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. could use ops.common.unpack_zerodim_and_defer 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.
This method is to be implemented by EA authors, so those can't use that helper (unless we expose somewhere a public version of this). (we could of course use that for our own EAs, but this PR is not changing any existing 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.
Added a comment about that |
||
""" | ||
|
@@ -347,7 +347,7 @@ def __eq__(self, other: Any) -> ArrayLike: | |
# underlying arrays) | ||
raise AbstractMethodError(self) | ||
|
||
def __ne__(self, other: Any) -> ArrayLike: | ||
def __ne__(self, other: Any) -> ArrayLike: # type: ignore[override] # NOQA | ||
""" | ||
Return for `self != other` (element-wise in-equality). | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not familiar with the
ignore[overrride] # NOQA
pattern. do we use that elsewhere?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I posted the mypy issue, but apparently forgot.
So the problem here is that mypy expects a "bool" return for
__eq__
since the baseobject
is typed that way in the stubs. In python/mypy#2783, the recommended way to solve this is the above with# type: ignore[override]
.But flake8 doesn't like that, hence also the #NOQA (PyCQA/pyflakes#475).
This was already done in another PR as well:
pandas/pandas/core/frame.py
Line 5062 in 7aa710a