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/1560#issuecomment-411815694,https://api.github.com/repos/pydata/xarray/issues/1560,411815694,MDEyOklzc3VlQ29tbWVudDQxMTgxNTY5NA==,222557,2018-08-09T16:21:41Z,2018-08-09T16:21:41Z,NONE,"What about a quick fix with `index.equals` like this (without the prints of course): https://github.com/maahn/xarray/commit/cf83991a161fbd89af2029a69cb50f1e09a5ed45. For the example above
arr = xr.DataArray(np.empty([1, 8996, 9223]))
arr = arr.stack(flat_dim=['dim_1', 'dim_2'])
%time arr.unstack('flat_dim')
the modified routine takes 5.75 s in comparison to 6min 40s with xr 0.10.7 and pd 0.23.3. Not sure whether this is related to a newer version, but `index.equals(full_idx)` takes actually only 2e-4 s in that example. When slicing or reordering is applied to the MultiIndex
arr = xr.DataArray(np.arange(20).reshape((1, 10, 2))).stack(flat_dim=['dim_1', 'dim_2'])
arr.isel(flat_dim = [1,2]).unstack('flat_dim')
or
arr = xr.DataArray(np.arange(20).reshape((1, 10, 2))).stack(flat_dim=['dim_1', 'dim_2'])
arr[:,::-1].unstack('flat_dim')
it will fall back to the old method with `reindex`. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,255989233