home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 330133651

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-330133651 https://api.github.com/repos/pydata/xarray/issues/1473 330133651 MDEyOklzc3VlQ29tbWVudDMzMDEzMzY1MQ== 6815844 2017-09-18T05:49:26Z 2017-09-18T05:49:26Z MEMBER

For the second issue pointed out in this comment, I noticed it is due to the somewhat irregular xr.DataArray construction behavior with MultiIndex,

```python In [1]: import numpy as np ...: import xarray as xr ...: import pandas as pd ...: ...: midx = pd.MultiIndex.from_product([list('abc'), [0, 1]], ...: names=('one', 'two')) ...: # midx is automatically converted to a coordinate ...: xr.DataArray(midx[:3], dims='z') ...: Out[1]: <xarray.DataArray (z: 3)> array([('a', 0), ('a', 1), ('b', 0)], dtype=object) Coordinates: * z (z) MultiIndex - one (z) object 'a' 'a' 'b' - two (z) int64 0 1 0

In [2]: # If a coordinate is explicitly specified, midx will be a data ...: xr.DataArray(midx[:3], dims='z', coords={'z': [0, 1, 2]}) ...: Out[2]: <xarray.DataArray (z: 3)> array([('a', 0), ('a', 1), ('b', 0)], dtype=object) Coordinates: * z (z) int64 0 1 2 ```

I added tests for this case.

{
    "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.741ms · About: xarray-datasette