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/issues/6976#issuecomment-1235533796,https://api.github.com/repos/pydata/xarray/issues/6976,1235533796,IC_kwDOAMm_X85JpL_k,4160723,2022-09-02T13:53:15Z,2022-09-02T13:53:15Z,MEMBER,"Xarray passes the label indexers to the underlying pandas index: ```python import pandas as pd # ""x"" coordinate index idx = pd.Index([2, 1, 0, 3, 5]) # da.sel(x=slice(2, 3)) does this: idx.slice_indexer(2, 3) # which returns slice(0, 4, None) # da.sel(x=[2, 3]) does this: idx.get_indexer([2, 3]) # which returns array([0, 3]) ``` > What might be possible is to warn if selecting with a slice and the index is not monotonic increasing or decreasing. Is it always desirable? Asked differently, are there cases where one intentionally wants to select with a slice a non monotonic index? If yes, a warning might be annoying. Maybe this could be clarified in the docs too? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1358960570