-
-
Notifications
You must be signed in to change notification settings - Fork 147
feat(index): ➕ arithmetic addition #1350
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
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.
Generally looks good.
I think you can also remove __add__()
and __radd__()
from IndexOpsMixin
because only Index
and Series
use IndexOpsMixin
as a subclass, and now the definitions will reside in class Series
and class Index
.
I was thinking there might be a way to just put all the operators in IndexOpsMixin
, but the challenge there is that Series.__add__(Series)
returns a Series
at runtime, but Index.__add__(Series)
also returns a Series
at runtime, so by not allowing Series
as a parameter to Index.__add__()
, the type checker will revert to the proper overload for Series.__radd__()
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 think you can also remove __add__()
and __radd__()
from IndexOpsMixin because only Index and Series use IndexOpsMixin as a subclass, and now the definitions will reside in class Series and class Index .
|
My mistake - I meant |
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.
thanks @cmp0xff
It seems that #1347 requires a series of changes, albeit not in the sense of a Pandas Series. This PR could be a good place to start.
assert_type()
to assert the type of any return value