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

NF: add string and slice slicing of AxesManager #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthew-brett
Copy link
Collaborator

@matthew-brett matthew-brett commented Jun 1, 2016

After this PR, you can do the following two slicing operations, that
previously raised errors:

>>> da = DataArray(np.ones((2, 3, 4)), 'abc')
>>> da.axes['b']
Axis(name='b', index=1, labels=None)
>>> da.axes[1:]
(Axis(name='b', index=1, labels=None), Axis(name='c', index=2,
labels=None))

Note that, as currently written, these two both return an Axis:

>>> da.axes['b']
Axis(name='b', index=1, labels=None)
>>> da.axes('b')
Axis(name='b', index=1, labels=None)

After this PR, you can do the following two slicing operations, that
previously raised errors:

>>> da = DataArray(np.ones((2, 3, 4)), 'abc')
>>> da.axes['b']
Axis(name='b', index=1, labels=None)
>>> da.axes[1:]
(Axis(name='b', index=1, labels=None), Axis(name='c', index=2,
labels=None))

Note that, as currently written, these two both return an Axis:

>>> da.axes['b']
Axis(name='b', index=1, labels=None)
>>> da.axes('b')
Axis(name='b', index=1, labels=None)
@matthew-brett
Copy link
Collaborator Author

Thinking about it - I am ambivalent about this change. It's a bit annoying that there are now two ways to get an axis by name, and you can always to the slicing by iterating over the axes.

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.

1 participant