home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 371184796

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/1973#issuecomment-371184796 https://api.github.com/repos/pydata/xarray/issues/1973 371184796 MDEyOklzc3VlQ29tbWVudDM3MTE4NDc5Ng== 10928117 2018-03-07T15:56:01Z 2018-03-07T18:59:18Z NONE

I just found one way to do it

python ds = ds2.transpose('a', 'n') tmp = [] for n, p in enumerate(ds.a): a = p.data.tolist() x = ds.x[n].data.tolist() y = ds.y[n].data.tolist() tmp.append(xr.DataArray(y, coords={'x': x, 'a': a}, dims='x'))

```python

ds1.equals(ds) True ```

I have a strong feeling that there should be much easier way to do it though...

Edit: I found a bit nicer way to do it python ds = ds2.set_coords('x') items = [ds.sel(a=a).swap_dims({'n': 'x'}) for a in ds.a] ds = xr.concat(items, dim='a') ds = ds.drop('n') ```python

ds1.equals(ds) True ``` however it still does not seem intuitive enough...

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