home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 431973631

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/2495#issuecomment-431973631 https://api.github.com/repos/pydata/xarray/issues/2495 431973631 MDEyOklzc3VlQ29tbWVudDQzMTk3MzYzMQ== 5635139 2018-10-22T20:32:48Z 2018-10-22T20:32:48Z MEMBER

Confirmed as fixed:

```python

In [1]: import xarray impor In [2]: import numpy

In [3]: xarray.DataArray(numpy.arange(3), dims=("x",), coords={"x": {"a", "b", "c"}}) ...:


TypeError Traceback (most recent call last) <ipython-input-3-6d18e1623a15> in <module> ----> 1 xarray.DataArray(numpy.arange(3), dims=("x",), coords={"x": {"a", "b", "c"}})

~/workspace/xarray/xarray/core/dataarray.py in init(self, data, coords, dims, name, attrs, encoding, fastpath) 225 226 data = as_compatible_data(data) --> 227 coords, dims = _infer_coords_and_dims(data.shape, coords, dims) 228 variable = Variable(dims, data, attrs, encoding, fastpath=True) 229

~/workspace/xarray/xarray/core/dataarray.py in _infer_coords_and_dims(shape, coords, dims) 62 if utils.is_dict_like(coords): 63 for k, v in coords.items(): ---> 64 new_coords[k] = as_variable(v, name=k) 65 elif coords is not None: 66 for dim, coord in zip(dims, coords):

~/workspace/xarray/xarray/core/variable.py in as_variable(obj, name) 88 elif isinstance(obj, (set, dict)): 89 raise TypeError( ---> 90 "variable %r has invalid type %r" % (name, type(obj))) 91 elif name is not None: 92 data = as_compatible_data(obj)

TypeError: variable 'x' has invalid type <class 'set'> ```

The original issue is https://github.com/pydata/xarray/issues/1691, and includes why we raise rather than coerce to an array

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  371990138
Powered by Datasette · Queries took 0.933ms · About: xarray-datasette