Skip to content

CLN: MultiIndex and Index no longer inherit from ndarray. #5080

Closed
@jtratner

Description

@jtratner

Changing to not be an ndarray subclass should make a number of things simpler (especially the API unification discussed in #3268). Plus, it will clarify the required interface for an Index object. It avoids all the workarounds to make Index immutable (instead, will define __array__ and __array_wrap__ and choose which other functions should be allowed).

  • [ ] Move Index underlying data to _data to mirror other objects. Keep metadata on object itself. (MI should work with only minor tweaks, given that it was always a fake ndarray)
  • [ ] Reimplement fastpath. (figure out how to do this inference again).
  • [ ] Move MI underlying data to _data (potentially turn levels into 2d int64 ndarray and keep labels as list of lists or as ordered-dict-like. not sure whether row-major or column-major makes more sense. I'm guessing row-major since that would speed key lookups)

How much backwards compatibility do we need to support? (pickle compat should be simple). E.g. do we want to do something like this:

def __getattr__(self, attr): 
    res = getattr(self._data, attr) 
    warnings.warn("Accessing %s on %s is deprecated. Convert to an ndarray first." %  
                 (attr, self.__class__.__name__))
    return res

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions