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/2619#issuecomment-448536594,https://api.github.com/repos/pydata/xarray/issues/2619,448536594,MDEyOklzc3VlQ29tbWVudDQ0ODUzNjU5NA==,6815844,2018-12-19T09:56:45Z,2018-12-19T09:56:45Z,MEMBER,"Thanks @shoyer I also noticed that the `.sel` method is working wrong too after the selection, ```python In [9]: ds.isel(xy=ds['x'] < 4).sel(x=5) # should be KeyError Out[9]: array([], dtype=int64) Coordinates: * y (y) int64 ``` Probably better to call `pd.MultiIndex.remove_unused_levels()` after each selection. I'll send a fix.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,392362056 https://github.com/pydata/xarray/issues/2619#issuecomment-448474051,https://api.github.com/repos/pydata/xarray/issues/2619,448474051,MDEyOklzc3VlQ29tbWVudDQ0ODQ3NDA1MQ==,1217238,2018-12-19T05:27:53Z,2018-12-19T05:27:53Z,MEMBER,"I agree, this is an xarray bug. It seems that we need to drop unused levels in the MultiIndex as part of `unstack()`, by invoking `pd.MultiIndex.remove_unused_levels()`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,392362056