Skip to content

inconsistent behavior in stack/unstack along one dimension #1431

Closed
@d-chambers

Description

@d-chambers

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions