Skip to content
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

Index __sub__ should check for instance of Index #8142

Closed
jasonzutty opened this issue Aug 29, 2014 · 4 comments · Fixed by #16629
Closed

Index __sub__ should check for instance of Index #8142

jasonzutty opened this issue Aug 29, 2014 · 4 comments · Fixed by #16629
Labels
API Design Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@jasonzutty
Copy link

add currently behaves like this:
def add(self, other):
if isinstance(other, Index):
return self.union(other)
else:
return Index(np.array(self) + other)

but subtraction falls straight through to diff.
so if index_object is an Int64Index, the following behavior takes place:
index_object + 1 => add one to all indices
index_object - 1 => error in diff
index_object + -1 => subtract one from all indices

@jreback
Copy link
Contributor

jreback commented Aug 29, 2014

guess that is a bit inconsistent. Would appreciate a pull-request.

@jreback jreback added this to the 0.15.1 milestone Aug 29, 2014
@jasonzutty jasonzutty mentioned this issue Aug 29, 2014
@jreback jreback modified the milestones: 0.15.0, 0.15.1 Aug 29, 2014
@jreback jreback modified the milestones: 0.15.1, 0.15.0 Sep 10, 2014
@jreback
Copy link
Contributor

jreback commented Sep 10, 2014

going to be moot after #8226

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@dsm054
Copy link
Contributor

dsm054 commented Jun 7, 2017

Looks like the #8226 changes indeed rendered this moot.

@jreback
Copy link
Contributor

jreback commented Jun 8, 2017

PR for validation of this would be great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants