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
384051686,MDExOlB1bGxSZXF1ZXN0MjMzMzU4NjU4,2574,Remove py37 collections.abc deprecation warnings,514522,closed,0,,,3,2018-11-25T06:19:18Z,2019-01-25T01:16:05Z,2019-01-25T01:16:05Z,CONTRIBUTOR,,0,pydata/xarray/pulls/2574,,"{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2574/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull
383057458,MDU6SXNzdWUzODMwNTc0NTg=,2560,Lock related problem in on travis-ci but not on local machine,514522,closed,0,,,10,2018-11-21T10:42:19Z,2018-12-23T20:11:32Z,2018-12-23T20:11:32Z,CONTRIBUTOR,,,,"There is a `KeyError` at `xarray.backends.file_manager.CachingFileManager` for the `acquire` method on these lines:

```
        with self._lock:
            try:
                file = self._cache[self._key]
```

which does not happen when I test on my macos.

Let me know if you require further testing on my part.


Full log:

```
=================================== FAILURES ===================================

________________________________ test_qtl_xarr _________________________________


self = <xarray.backends.file_manager.CachingFileManager object at 0x7f59e2cab978>


    def acquire(self):

        """"""Acquiring a file object from the manager.

    

        A new file is only opened if it has expired from the

        least-recently-used cache.

    

        This method uses a reentrant lock, which ensures that it is

        thread-safe. You can safely acquire a file in multiple threads at the

        same time, as long as the underlying file object is thread-safe.

    

        Returns

        -------

        An open file object, as returned by ``opener(*args, **kwargs)``.

        """"""

        with self._lock:

            try:

>               file = self._cache[self._key]


miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/file_manager.py:137: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 


self = <xarray.backends.lru_cache.LRUCache object at 0x7f5a04a9c630>

key = [<function _open_netcdf4_group at 0x7f5a04abc1e0>, ('/tmp/tmprj8lwlat/xarr.hdf5', CombinedLock([<SerializableLock: 447...>])), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('group', '/foo/chr1'), ('persist', False))]


    def __getitem__(self, key):

        # record recent use of the key by moving it to the front of the list

        with self._lock:

>           value = self._cache[key]

E           KeyError: [<function _open_netcdf4_group at 0x7f5a04abc1e0>, ('/tmp/tmprj8lwlat/xarr.hdf5', CombinedLock([<SerializableLock: 4471090f-419e-49bd-9d27-4156e09febdd>, <SerializableLock: b9eb5ba1-2830-402e-b48f-3ef45768b7c2>])), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('group', '/foo/chr1'), ('persist', False))]


miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/lru_cache.py:43: KeyError


During handling of the above exception, another exception occurred:


    def test_qtl_xarr():

        with limix.example.file_example(""xarr.hdf5.bz2"") as filepath:

            filepath = limix.sh.extract(filepath, verbose=False)

            sample_ids = limix.io.hdf5.fetch(filepath, ""/foo/chr1/col_header/sample_ids"")

    

            rsid = dict()

            for i in range(1, 3):

                rsid[i] = limix.io.hdf5.fetch(

                    filepath, ""/foo/chr{}/row_header/rsid"".format(i)

                )

    

            G = []

            for i in range(1, 3):

>               g = xr.open_dataset(filepath, ""/foo/chr{}"".format(i))[""matrix""]


miniconda/envs/test-environment/lib/python3.6/site-packages/limix/qtl/test/test_qtl_xarr.py:20: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/api.py:320: in open_dataset

    filename_or_obj, group=group, lock=lock, **backend_kwargs)

miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:355: in open

    return cls(manager, lock=lock, autoclose=autoclose)

miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:314: in __init__

    self.format = self.ds.data_model

miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:359: in ds

    return self._manager.acquire().value

miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/file_manager.py:143: in acquire

    file = self._opener(*self._args, **kwargs)

miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:247: in _open_netcdf4_group

    ds = nc4.Dataset(filename, mode=mode, **kwargs)

netCDF4/_netCDF4.pyx:2135: in netCDF4._netCDF4.Dataset.__init__

    ???

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 


>   ???

E   OSError: [Errno -101] NetCDF: HDF error: b'/tmp/tmprj8lwlat/xarr.hdf5'


netCDF4/_netCDF4.pyx:1752: OSError

===================== 1 failed, 50 passed in 65.82 seconds =====================

The command ""bash <(curl -fsSL https://raw.githubusercontent.com/horta/ci/master/travis.sh)"" exited with 1.




Done. Your build exited with 1.
```","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2560/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
384050983,MDExOlB1bGxSZXF1ZXN0MjMzMzU4MjY4,2573,python setup.py test now works by default,514522,closed,0,,,2,2018-11-25T06:06:58Z,2018-11-25T20:00:03Z,2018-11-25T19:59:57Z,CONTRIBUTOR,,0,pydata/xarray/pulls/2573,You don't need to have pytest-runner before-hand.,"{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2573/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull