issues: 231308952
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
231308952 | MDExOlB1bGxSZXF1ZXN0MTIyNDE4MjA3 | 1426 | scalar_level in MultiIndex | 6815844 | closed | 0 | 10 | 2017-05-25T11:03:05Z | 2019-01-14T21:20:28Z | 2019-01-14T21:20:27Z | MEMBER | 0 | pydata/xarray/pulls/1426 |
[Edit for more clarity] I restarted a new branch to fix #1408 (I closed the older one #1412). Because the changes I made is relatively large, here I summarize this PR. SumamryIn this PR, I newly added two kinds of levels in MultiIndex, Changes in behaviors.
Examples of the output are shown below. Any suggestions for these behaviors are welcome. ```python In [1]: import numpy as np ...: import xarray as xr ...: ...: ds1 = xr.Dataset({'foo': (('x',), [1, 2, 3])}, {'x': [1, 2, 3], 'y': 'a'}) ...: ds2 = xr.Dataset({'foo': (('x',), [4, 5, 6])}, {'x': [1, 2, 3], 'y': 'b'}) ...: # example data ...: ds = xr.concat([ds1, ds2], dim='y').stack(yx=['y', 'x']) ...: ds Out[1]: <xarray.Dataset> Dimensions: (yx: 6) Coordinates: * yx (yx) MultiIndex - y (yx) object 'a' 'a' 'a' 'b' 'b' 'b' # <--- this is index-level - x (yx) int64 1 2 3 1 2 3 # <--- this is also index-level Data variables: foo (yx) int64 1 2 3 4 5 6 In [2]: # 1. indexing a scalar converts In [3]: # 2. indexing a single element from MultiIndex makes a In [6]: # 3. Enables to selecting along a ``` Changes in the public APIsSome changes were necessary to the public APIs, though I tried to minimize them.
Implementation summaryThe main changes in the implementation is the addition of our own wrapper of What we can do nowThe main merit of this proposal is that it enables us to handle
What we cannot do nowWith the current implementation, we can do
Similary, we can neither do What are to be decided
TODOs
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1426/reactions", "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | pull |