home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 335319183

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/pull/1473#issuecomment-335319183 https://api.github.com/repos/pydata/xarray/issues/1473 335319183 MDEyOklzc3VlQ29tbWVudDMzNTMxOTE4Mw== 6815844 2017-10-09T23:45:55Z 2017-10-10T12:12:04Z MEMBER

@shoyer, thanks for your review.

If we try to make behavior "intuitive" for 80% of use-cases, it only makes the remaining 20% more baffling and error prone.

OK. It makes sense also for me. Merging your PR.

I would be OK with adding a warning that there are still a few unresolved edge cases involving MultiIndex.

Actually, the vectorized label-indexing currently does not work almost entirely with MultiIndex. I think of the following cases where appropriate error messages are required,

python In [1]: import xarray as xr ...: import pandas as pd ...: ...: midx = pd.MultiIndex.from_tuples( ...: [(1, 'a'), (2, 'b'), (3, 'c')], ...: names=['x0', 'x1']) ...: da = xr.DataArray([0, 1, 2], dims=['x'], ...: coords={'x': midx}) ...: da ...: Out[1]: <xarray.DataArray (x: 3)> array([0, 1, 2]) Coordinates: * x (x) MultiIndex - x0 (x) int64 1 2 3 - x1 (x) object 'a' 'b' 'c'

  • da.sel(x=[(1, 'a'), (2, 'b')])
  • da.sel(x0='a')

works as expected,

  • da.sel(x0=[1, 2])

fail without appropriate error messages

  • da.sel(x=xr.DataArray([np.array(midx[:2]), np.array(midx[-2:])], dims=['y', 'z']))

destructs the MultiIndex structure silently.

I will add better Exceptions later today.

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