home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 392362056

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
392362056 MDU6SXNzdWUzOTIzNjIwNTY= 2619 Selection of MultiIndex makes following `unstack` wrong 6815844 closed 0     2 2018-12-18T22:26:31Z 2018-12-24T15:37:27Z 2018-12-24T15:37:27Z MEMBER      

Code Sample, a copy-pastable example if possible

```python import numpy as np import xarray as xr

ds = xr.DataArray(np.arange(40).reshape(8, 5), dims=['x', 'y'],
coords={'x': np.arange(8), 'y': np.arange(5)}).stack(xy=['x', 'y']) ds.isel(xy=ds['x'] < 4).unstack()

Out[1]: <xarray.DataArray (x: 8, y: 5)> array([[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.], [10., 11., 12., 13., 14.], [15., 16., 17., 18., 19.], [nan, nan, nan, nan, nan], [nan, nan, nan, nan, nan], [nan, nan, nan, nan, nan], [nan, nan, nan, nan, nan]]) Coordinates: * x (x) int64 0 1 2 3 4 5 6 7 * y (y) int64 0 1 2 3 4 ```

Problem description

After unstack, there are still values that are not selected by the previous isel. Probably the upstream bug?

Expected Output

python Out[1]: <xarray.DataArray (x: 8, y: 5)> array([[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.], [10., 11., 12., 13., 14.], [15., 16., 17., 18., 19.]]) Coordinates: * x (x) int64 0 1 2 3 * y (y) int64 0 1 2 3 4

Output of xr.show_versions()

# Paste the output here xr.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 3.7.1.final.0 python-bits: 64 OS: Linux OS-release: 4.15.0-42-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.10.9 pandas: 0.23.4 numpy: 1.15.4 scipy: 1.1.0 netCDF4: 1.4.2 h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.2.1 PseudonetCDF: None rasterio: None iris: None bottleneck: None cyordereddict: None dask: 1.0.0 distributed: 1.25.0 matplotlib: 3.0.1 cartopy: None seaborn: None setuptools: 40.5.0 pip: 18.1 conda: None pytest: 4.0.1 IPython: 7.1.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2619/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 247.876ms · About: xarray-datasette