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

inconsistent behavior in stack/unstack along one dimension #1431

Closed
d-chambers opened this issue May 28, 2017 · 4 comments
Closed

inconsistent behavior in stack/unstack along one dimension #1431

d-chambers opened this issue May 28, 2017 · 4 comments
Labels

Comments

@d-chambers
Copy link

d-chambers commented May 28, 2017

I am using Ubuntu 16, python 3.6, and xarray 0.9.1

A DataArray can be stacked along one dimension, but when unstack is called a ValueError is raised. It seems that either unstack should work, or calling stack should also raise a ValueError.

import xarray as xr

dims = ['a', 'b']
coords = {'a': range(2), 'b':range(2)}
values = [[0, 0], [0, 0]]

dar = xr.DataArray(values, coords, dims)

stacked = dar.stack(z=('a',))  # this works

unstack = stacked.unstack('z')  # this raises ValueError
@fujiisoup
Copy link
Member

fujiisoup commented May 28, 2017

Hi @d-chambers

I am currently working for more consistent MultiIndex behaviour in #1426 .
I will take a look also for stack-unstack behavior.

@shoyer
Copy link
Member

shoyer commented May 30, 2017

Agreed, this does seem inconsistent. Thanks for the report!

@mathause
Copy link
Collaborator

This works with current master - so it can probably be closed? @d-chambers? (I think there is a error in the example - shouldn't it be unstack = stacked.unstack('z')?)

@d-chambers
Copy link
Author

Yes, fixed the example. This seems to be fixed now, closing. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants