issues: 316507549
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
316507549 | MDU6SXNzdWUzMTY1MDc1NDk= | 2071 | spell check: could not `bebroadcast` | 3698640 | closed | 0 | 0 | 2018-04-21T16:59:09Z | 2018-04-21T17:42:06Z | 2018-04-21T17:42:06Z | CONTRIBUTOR | Spelling error in value error raised on index-based assignment with incorrect shapeVery easy one here: ```python In [1]: import xarray as xr, pandas as pd, numpy as np In [2]: da = xr.DataArray(np.random.random((2, 3)), dims=['x','y']) In [3]: da Out[3]: <xarray.DataArray (x: 2, y: 3)> array([[0.882927, 0.604024, 0.316146], [0.06342 , 0.503182, 0.297988]]) Dimensions without coordinates: x, y In [4]: da[0, 1] = [1, 2]ValueError Traceback (most recent call last) <ipython-input-4-1fbe1d206e00> in <module>() ----> 1 da[0, 1] = [1, 2] ~/miniconda2/envs/xarray-dev/lib/python3.6/site-packages/xarray/core/dataarray.py in setitem(self, key, value) 486 key = {k: v.variable if isinstance(v, DataArray) else v 487 for k, v in self._item_key_to_dict(key).items()} --> 488 self.variable[key] = value 489 490 def delitem(self, key): ~/miniconda2/envs/xarray-dev/lib/python3.6/site-packages/xarray/core/variable.py in setitem(self, key, value) 682 'shape mismatch: value array of shape %s could not be' 683 'broadcast to indexing result with %s dimensions' --> 684 % (value.shape, len(dims))) 685 if value.ndim == 0: 686 value = Variable((), value) ValueError: shape mismatch: value array of shape (2,) could not bebroadcast to indexing result with 0 dimensions In [5]: xr.show_versions()
/Users/delgadom/miniconda2/envs/xarray-dev/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from INSTALLED VERSIONScommit: None python: 3.6.4.final.0 python-bits: 64 OS: Darwin OS-release: 17.4.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.10.2 pandas: 0.22.0 numpy: 1.14.2 scipy: 1.0.0 netCDF4: 1.3.1 h5netcdf: 0.5.0 h5py: 2.7.1 Nio: None zarr: 2.2.0 bottleneck: 1.2.1 cyordereddict: None dask: 0.17.2 distributed: 1.21.4 matplotlib: 2.2.2 cartopy: 0.15.1 seaborn: 0.8.1 setuptools: 38.5.1 pip: 9.0.1 conda: None pytest: 3.4.1 IPython: 6.2.1 sphinx: 1.6.6 ``` Problem descriptionThe error message in variable.py#L682 seems to be missing an end-of-line space. Happy to create a PR. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2071/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |