home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 357156174

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
357156174 MDU6SXNzdWUzNTcxNTYxNzQ= 2399 DataArray.loc fails for duplicates where DataFrame works 514522 closed 0     11 2018-09-05T10:03:12Z 2020-09-11T04:32:16Z 2020-09-11T04:32:16Z CONTRIBUTOR      

```python import pandas as pd import xarray as xr

df = pd.DataFrame(data=[0, 1], index=list("aa")) da = xr.DataArray(df) print(df.loc[list("a")]) # works print(da.loc[{"dim_0": list("a")}]) # fails ``` Xarray fails with the exception

Traceback (most recent call last): File "session4.py", line 7, in <module> print(da.loc[{"dim_0": list("a")}]) # fails File "/usr/local/anaconda3/lib/python3.6/site-packages/xarray/core/dataarray.py", line 104, in __getitem__ return self.data_array.sel(**key) File "/usr/local/anaconda3/lib/python3.6/site-packages/xarray/core/dataarray.py", line 784, in sel indexers=indexers, drop=drop, method=method, tolerance=tolerance) File "/usr/local/anaconda3/lib/python3.6/site-packages/xarray/core/dataset.py", line 1509, in sel self, indexers=indexers, method=method, tolerance=tolerance) File "/usr/local/anaconda3/lib/python3.6/site-packages/xarray/core/coordinates.py", line 355, in remap_label_indexers obj, v_indexers, method=method, tolerance=tolerance File "/usr/local/anaconda3/lib/python3.6/site-packages/xarray/core/indexing.py", line 250, in remap_label_indexers dim, method, tolerance) File "/usr/local/anaconda3/lib/python3.6/site-packages/xarray/core/indexing.py", line 186, in convert_label_indexer indexer = get_indexer_nd(index, label, method, tolerance) File "/usr/local/anaconda3/lib/python3.6/site-packages/xarray/core/indexing.py", line 117, in get_indexer_nd flat_indexer = index.get_indexer(flat_labels, **kwargs) File "/usr/local/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3244, in get_indexer raise InvalidIndexError('Reindexing only valid with uniquely' pandas.core.indexes.base.InvalidIndexError: Reindexing only valid with uniquely valued Index objects

Output of xr.show_versions()

``` INSTALLED VERSIONS


commit: None python: 3.6.6.final.0 python-bits: 64 OS: Darwin OS-release: 17.7.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8

xarray: 0.10.8 pandas: 0.23.4 numpy: 1.15.1 scipy: 1.1.0 netCDF4: 1.4.1 h5netcdf: None h5py: 2.8.0 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.19.0 distributed: 1.23.0 matplotlib: 2.2.3 cartopy: None seaborn: 0.9.0 setuptools: 40.2.0 pip: 18.0 conda: 4.5.11 pytest: 3.7.3 IPython: 6.5.0 sphinx: 1.7.7 ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2399/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
  • 11 rows from issue in issue_comments
Powered by Datasette · Queries took 1.432ms · About: xarray-datasette