Skip to content

Support fancy indexing #42

Description

@fperez

Currently fancy indexing isn't supported at all.

In [79]: cap_ax_spec = 'capitals', ['washington', 'london', 'berlin', 'paris', 'moscow']
    ...: time_ax_spec = 'time', ['0015', '0615', '1215', '1815']
    ...: t = DataArray(np.arange(4*5).reshape(4,5), [time_ax_spec, cap_ax_spec])
    ...: t.axis.capitals[['paris', 'london']]
    ...: 
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/home/fperez/research/code/datarray/datarray/ in ()
      2 time_ax_spec = 'time', ['0015', '0615', '1215', '1815']
      3 t = DataArray(np.arange(4*5).reshape(4,5), [time_ax_spec, cap_ax_spec])
----> 4 t.axis.capitals[['paris', 'london']]

/home/fperez/research/code/datarray/datarray/datarray.py in __getitem__(self, key)
    218         # XXX We don't handle fancy indexing at the moment

    219         if isinstance(key, (np.ndarray, list)):
--> 220             raise NotImplementedError('We do not handle fancy indexing yet')
    221         parent_arr = self.parent_arr # local for speed
    222         parent_arr_ndim = parent_arr.ndim

NotImplementedError: We do not handle fancy indexing yet

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions