Skip to content

ENH: Implement Index.__invert__ #45006

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
Dec 23, 2021
Merged

Conversation

jbrockmendel
Copy link
Member

Could be considered a bugfix, as we have __inv__, which i think is a py2 leftover

@@ -1401,7 +1401,7 @@ class Timedelta(_Timedelta):
# Arithmetic Methods
# TODO: Can some of these be defined in the cython class?

__inv__ = _op_unary_method(lambda x: -x, '__inv__')
__inverse__ = _op_unary_method(lambda x: -x, '__inverse__')
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be __invert__?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, will update

Copy link
Member Author

Choose a reason for hiding this comment

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

huh looks like when i make this __invert__ we get nutty results instead of raising. better to remove it entirely and keep the test that we raise

Copy link
Member Author

Choose a reason for hiding this comment

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

updated + greenish (windows timeout)

@jreback jreback added the Index Related to the Index class or subclasses label Dec 22, 2021
@jreback jreback added this to the 1.4 milestone Dec 23, 2021
@jreback jreback merged commit 718cec9 into pandas-dev:master Dec 23, 2021
@jbrockmendel jbrockmendel deleted the bug-inv branch December 23, 2021 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: Index should support __inverse__ ops
2 participants