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/5384#issuecomment-849246165,https://api.github.com/repos/pydata/xarray/issues/5384,849246165,MDEyOklzc3VlQ29tbWVudDg0OTI0NjE2NQ==,5635139,2021-05-27T01:31:49Z,2021-05-27T01:32:18Z,MEMBER,"This does look like a bug, specifically affecting MultiIndexes containing only one Index.
The issue seems to be that `self.get_index('c')` returns a normal index:
```python
4020 non_multi_dims = [
4021 d for d in dims if not isinstance(self.get_index(d), pd.MultiIndex)
4022 ]
4023 if non_multi_dims:
-> 4024 raise ValueError(
4025 ""cannot unstack dimensions that do not ""
4026 f""have a MultiIndex: {non_multi_dims}""
4027 )
4028
4029 result = self.copy(deep=False)
4030 for dim in dims:
ipdb> self.get_index('c')
Index([(0,)], dtype='object') # <- single index
ipdb> self
Dimensions: (c: 1)
Coordinates:
* c (c) MultiIndex # <- multi index
- b (c) int64 0
a (c) int64 0
Data variables:
d (c) int64 0
```
I'm not sure how common it is for MultiIndexes to have a single index, but we should be general over any number.
We'd definitely take a fix for this. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,903055859