Skip to content

BUG: fix Index's __iadd__ methods #5053

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 1 commit into from
Oct 2, 2013
Merged

Conversation

wcbeard
Copy link
Contributor

@wcbeard wcbeard commented Sep 30, 2013

closes #4996

Aliases iadd = add.

Not doing anything else for now until time to consider.

@jtratner
Copy link
Contributor

@jreback are you sure this doesn't break back-compat? Seems like it would.

@jreback
Copy link
Contributor

jreback commented Sep 30, 2013

@jtratner I think its ok; the problem is iadd was using the numpy iadd which effectively does the same thing, but doesn't do the asignment correctly (because its a numpy method and doesn't go thru the python assignment machinery)

@jtratner
Copy link
Contributor

I just don't think you should block the non inplace methods without
deprecating them first. It's not unreasonable to know that Index is a thin
wrapper around ndarray, etc.

@jreback
Copy link
Contributor

jreback commented Sep 30, 2013

they don't work properly is the issue as they update the Index inplace which is semantically wrong (because its not calling the right method).

@jtratner
Copy link
Contributor

I think it's fine to block inplace, but I thought you were blocking things
like mul?

@@ -93,6 +93,9 @@ class Index(FrozenNDArray):

_engine_type = _index.ObjectEngine

__mul__ = __trudev__ = __floordiv__ = __pow__ = __imul__ = __itruediv__ = \
Copy link
Contributor

Choose a reason for hiding this comment

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

ok..let's just limit these to the i methods you have here: imul,itruediv,ifloordiv,ipow,

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure that _disabled is what you actually want, because it's not that it's immutable, it's that it returns the right type. /bikeshedding

@jreback
Copy link
Contributor

jreback commented Sep 30, 2013

@d10genes ok...this got too complicated! sorry.....let's just do the iadd; rest can do in a separate PR

@wcbeard
Copy link
Contributor Author

wcbeard commented Oct 1, 2013

iadd...and isub? or just iadd

@jtratner
Copy link
Contributor

jtratner commented Oct 1, 2013

Just __iadd__. Leaving implementing any new features for later.

@ghost ghost assigned jtratner Oct 1, 2013
@jtratner
Copy link
Contributor

jtratner commented Oct 1, 2013

I went ahead and updated the title of this PR to make it clearer what's going on. We definitely appreciate you being game on this - please just remove the __isub__ and __sub__ and then squash your commits. Should be ready to merge at that point.

If you want, you could open a new pull request with your proposed __sub__ implementation.

fixes pandas-dev#4996

alias Index's __isub__ to __sub__

document fixes to pandas-dev#4996

index isub test

roll back everything non-iadd related
@jreback jreback merged commit c66a5fd into pandas-dev:master Oct 2, 2013
@jreback
Copy link
Contributor

jreback commented Oct 2, 2013

thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing columns with += gives UnboundLocalError
3 participants