Skip to content

Index __sub__ should check for instance of Index #8142

Closed
@jasonzutty

Description

@jasonzutty

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions