issues: 573052057
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
573052057 | MDU6SXNzdWU1NzMwNTIwNTc= | 3814 | Allow an ellipsis in stack? | 5635139 | closed | 0 | 1 | 2020-02-28T22:57:58Z | 2020-03-19T23:19:18Z | 2020-03-19T23:19:18Z | MEMBER | Could we add the ability to use an ellipsis to represent all dims in more places? For example, MCVE Code Sample```python In [14]: data = np.arange(15, 301, 15).reshape(2, 10) In [15]: da.stack(z=['x','y']) In [16]: da.stack(z=[...])KeyError Traceback (most recent call last) <ipython-input-16-a92d0ffe931a> in <module> ----> 1 da.stack(z=[...]) ~/workspace/./.venv/lib64/python3.6/site-packages/xarray/core/dataarray.py in stack(self, dimensions, dimensions_kwargs) 1739 DataArray.unstack 1740 """ -> 1741 ds = self._to_temp_dataset().stack(dimensions, dimensions_kwargs) 1742 return self._from_temp_dataset(ds) 1743 ~/workspace/./.venv/lib64/python3.6/site-packages/xarray/core/dataset.py in stack(self, dimensions, **dimensions_kwargs) 3291 result = self 3292 for new_dim, dims in dimensions.items(): -> 3293 result = result._stack_once(dims, new_dim) 3294 return result 3295 ~/workspace/./.venv/lib64/python3.6/site-packages/xarray/core/dataset.py in _stack_once(self, dims, new_dim) 3246 3247 # consider dropping levels that are unused? -> 3248 levels = [self.get_index(dim) for dim in dims] 3249 idx = utils.multiindex_from_product_levels(levels, names=dims) 3250 variables[new_dim] = IndexVariable(new_dim, idx) ~/workspace/./.venv/lib64/python3.6/site-packages/xarray/core/dataset.py in <listcomp>(.0) 3246 3247 # consider dropping levels that are unused? -> 3248 levels = [self.get_index(dim) for dim in dims] 3249 idx = utils.multiindex_from_product_levels(levels, names=dims) 3250 variables[new_dim] = IndexVariable(new_dim, idx) ~/workspace/./.venv/lib64/python3.6/site-packages/xarray/core/common.py in get_index(self, key) 378 """ 379 if key not in self.dims: --> 380 raise KeyError(key) 381 382 try: KeyError: Ellipsis ``` Expected OutputIdentical between Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3814/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |