-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: Index.__cmp__(Series) return NotImplemented #37160
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
Conversation
@@ -744,11 +744,13 @@ def test_dti_cmp_tdi_tzawareness(self, other): | |||
|
|||
result = dti == other | |||
expected = np.array([False] * 10) | |||
tm.assert_numpy_array_equal(result, expected) | |||
if isinstance(other, Series): |
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.
so this is technically a small api change? e.g. a dti == Series will now give a boolean Series? do we do this 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.
API change, yes. not just DTI, but any index == series
will now return a Series[bool] instead of ndarray[bool]
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.
hmm then i am no sure I like this api change. We return bool ndarrays on purpose from comparisions to avoid having to align everything. I think this could potentially be a nasty user trap.
Is there a reason you want to do this (aside from reconciling / cleaning).
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.
My motivation is pretty much "hunt down special cases"
IIRC @jorisvandenbossche mentioned a ways back that the existing behavior is from a time before series[bool_dtypes_series]
was supported, but i could be off on that
if this isnt something we want to do, can close |
Discussed on Nov 2020 dev call, decided to put this off until we have BoolIndex |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Gets rid of an unnecessary special case.
Could do this as a deprecation first.