Skip to content

ENH: enable mul, div on Index by dispatching to Series #34160

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 13 commits into from
Aug 6, 2020

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented May 13, 2020

One of the last remaining inconsistencies between Index and Series arithmetic is that division and multiplication is entirely disabled for object-dtype Index, while for Series we operate pointwise. This PR makes Index behave the same way, and simplifies the code by using existing Series-op-wrapping code to do so.

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

I'm pretty sure there is at least one issue for this, will track it down.

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.

Can you explain your changes?

@jbrockmendel jbrockmendel added Enhancement Numeric Operations Arithmetic, Comparison, and Logical operations labels May 17, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

are we actually testing these? it seems we are enabling all numeric methods; do all of these even make sense on datetimelikes?

@jbrockmendel
Copy link
Member Author

are we actually testing these?

Yes. In particular see the tests.arithmetic tests that are currently xfailed that this un-xfails.

it seems we are enabling all numeric methods; do all of these even make sense on datetimelikes?

DTI/PI get these methods from DTA/PA, which define them with make_invalid_op, so these correctly raise.

@jreback jreback added this to the 1.1 milestone Jun 8, 2020
@jreback
Copy link
Contributor

jreback commented Jun 8, 2020

ok seems fine to me. @jorisvandenbossche

@jreback jreback removed this from the 1.1 milestone Jul 9, 2020
@jreback jreback added this to the 1.2 milestone Aug 3, 2020
@jreback
Copy link
Contributor

jreback commented Aug 3, 2020

lgtm. do we need a release note for the additional things that Index can now do? (e.g. can you enumerate them). pls merge master.

@jbrockmendel
Copy link
Member Author

updated+green

@jreback
Copy link
Contributor

jreback commented Aug 6, 2020

thanks @jbrockmendel

@jreback jreback merged commit b05fdcd into pandas-dev:master Aug 6, 2020
@jbrockmendel jbrockmendel deleted the index-arith branch August 6, 2020 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants