issue_comments: 1260618693
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/6392#issuecomment-1260618693 | https://api.github.com/repos/pydata/xarray/issues/6392 | 1260618693 | IC_kwDOAMm_X85LI4PF | 4160723 | 2022-09-28T09:13:00Z | 2022-09-28T12:52:01Z | MEMBER |
For For a ```python import pandas as pd import xarray as xr from xarray.indexes import PandasMultiIndex pd_idx = pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=("foo", "bar")) idx = PandasMultiIndex(pd_idx, "x") indexes = {"x": idx, "foo": idx, "bar": idx} coords = idx.create_variables() ds = xr.Dataset(coords=coords, indexes=indexes) ``` For more convenience, we could add a class method to ```python this calls PandasMultiIndex.init() and PandasMultiIndex.create_variables() internallyindexes, coords = PandasMultiIndex.from_pandas_index(pd_idx, "x") ds = xr.Dataset(coords=coords, indexes=indexes) ``` Instead of ```python xmidx = PandasMultiIndex.from_pandas_index(pd_idx, "x") ds = xr.Dataset(coords=xmidx.variables, indexes=xmidx) ``` For even more convenience, I think it might be reasonable to support special handling of ```python both cases below will implicitly add the coordinates found in
|
{
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
1175329407 |