issues: 366510937
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
366510937 | MDU6SXNzdWUzNjY1MTA5Mzc= | 2460 | Update docs to include how to Join using a non-index coord | 5635139 | open | 0 | 5635139 | 3 | 2018-10-03T20:19:15Z | 2018-11-01T15:37:44Z | MEMBER | I originally posted this on SO, as I thought it was a user question rather than a library issue. But after working on it more today, I'm not so sure. I'm trying to do a 'join' in xarray, but using a non-index coordinate rather than a shared dim. I have a Dataset indexed on 'a' with a coord on 'b', and a DataArray indexed on 'b': ```python In [17]: ds=xr.Dataset(dict(a=(('x'),np.random.rand(10))), coords=dict(b=(('x'),list(range(10))))) In [18]: ds Out[18]: <xarray.Dataset> Dimensions: (x: 10) Coordinates: b (x) int64 0 1 2 3 4 5 6 7 8 9 Dimensions without coordinates: x Data variables: a (x) float64 0.3634 0.2132 0.6945 0.5359 0.1053 0.07045 0.5945 ... In [19]: da=xr.DataArray(np.random.rand(10), dims=('b',), coords=dict(b=(('b'),list(range(10))))) In [20]: da Out[20]: <xarray.DataArray (b: 10)> array([0.796987, 0.275992, 0.747882, 0.240374, 0.435143, 0.285271, 0.753582, 0.556038, 0.365889, 0.434844]) Coordinates: * b (b) int64 0 1 2 3 4 5 6 7 8 9 ``` Can I add da onto my dataset, by joining on ds.b equalling da.b? The result would be:
(for completeness - the data isn't current in the correct position) |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2460/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |