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/3925#issuecomment-1146877063,https://api.github.com/repos/pydata/xarray/issues/3925,1146877063,IC_kwDOAMm_X85EW_SH,5347026,2022-06-05T20:18:26Z,2022-06-05T20:18:26Z,NONE,"> In #5692 it is possible to perform selection using non-dimension coordinates with an index, although there's no easy way yet to set an index for such coordinates (this will be done in a follow-up PR by updating the API of `set_index`).
@benbovy, please could you give an example how it is possible?
I would like `sel based on a non-dim coordinate` to be as fast as `sel based on the dim itself` as per the following timings:
```python
# sel based on a non-dim coordinate
# (using this coordinate directly .sel(product_id=26) would result in error ""'no index found for coordinate product_id"")
%timeit xds.sel(product=xds.product_id==26)
1.54 ms ± 64.2 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
# sel based on the dim itself
%timeit xds.sel(product='GN91 Glove Medium')
499 µs ± 16.1 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
%timeit xds.where(xds.product_id==26, drop=True)
4.17 ms ± 39 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,592312709
https://github.com/pydata/xarray/pull/3925#issuecomment-607584705,https://api.github.com/repos/pydata/xarray/issues/3925,607584705,MDEyOklzc3VlQ29tbWVudDYwNzU4NDcwNQ==,24736507,2020-04-02T02:24:04Z,2020-04-02T02:24:04Z,NONE,"Hello @TomNicholas! Thanks for opening this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:
* In the file [`xarray/core/indexing.py`](https://github.com/pydata/xarray/blob/558721e71da2b627028ebc533887c0e6e7a30db5/xarray/core/indexing.py):
> [Line 219:12](https://github.com/pydata/xarray/blob/558721e71da2b627028ebc533887c0e6e7a30db5/xarray/core/indexing.py#L219): [E131](https://duckduckgo.com/?q=pep8%20E131) continuation line unaligned for hanging indent
> [Line 220:14](https://github.com/pydata/xarray/blob/558721e71da2b627028ebc533887c0e6e7a30db5/xarray/core/indexing.py#L220): [E131](https://duckduckgo.com/?q=pep8%20E131) continuation line unaligned for hanging indent
> [Line 223:10](https://github.com/pydata/xarray/blob/558721e71da2b627028ebc533887c0e6e7a30db5/xarray/core/indexing.py#L223): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 223:10](https://github.com/pydata/xarray/blob/558721e71da2b627028ebc533887c0e6e7a30db5/xarray/core/indexing.py#L223): [E117](https://duckduckgo.com/?q=pep8%20E117) over-indented
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,592312709