issues: 1485037066
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1485037066 | PR_kwDOAMm_X85Ez9Gj | 7368 | Expose "Coordinates" as part of Xarray's public API | 4160723 | closed | 0 | 31 | 2022-12-08T16:59:29Z | 2023-08-30T09:11:57Z | 2023-07-21T20:40:03Z | MEMBER | 0 | pydata/xarray/pulls/7368 |
This is a rework of #7214. It follows the suggestions made in https://github.com/pydata/xarray/pull/7214#issuecomment-1295283938, https://github.com/pydata/xarray/pull/7214#issuecomment-1297046405 and https://github.com/pydata/xarray/pull/7214#issuecomment-1293774799:
EDIT: EDIT2: it ended up as a pretty big refactor with the promotion of Some examples of usage: ```python import pandas as pd import xarray as xr midx = pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=("one", "two")) coords = xr.Coordinates.from_pandas_multiindex(midx, "x") Coordinates:* x (x) object MultiIndex* one (x) object 'a' 'a' 'b' 'b'* two (x) int64 1 2 1 2ds = xr.Dataset(coords=coords) <xarray.Dataset>Dimensions: (x: 4)Coordinates:* x (x) object MultiIndex* one (x) object 'a' 'a' 'b' 'b'* two (x) int64 1 2 1 2Data variables:emptyds_to_be_deprecated = xr.Dataset(coords={"x": midx}) ds_to_be_deprecated.identical(ds) Trueda = xr.DataArray([1, 2, 3, 4], dims="x", coords=ds.coords) <xarray.DataArray (x: 4)>array([1, 2, 3, 4])Coordinates:* x (x) object MultiIndex* one (x) object 'a' 'a' 'b' 'b'* two (x) int64 1 2 1 2``` TODO:
@shoyer, @dcherian, anyone -- what do you think about the approach proposed here? I'd like to check that with you before going further with tests, docs, etc. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7368/reactions", "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | pull |