diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index f0f9b534776..68960a7fab7 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -7195,7 +7195,7 @@ def drop_duplicate_coords( if base_coord is not None: # remove tmp_dim - new = new.swap_dims({tmp_dim: base_coord}).drop(tmp_dim) + new = new.swap_dims({tmp_dim: base_coord}).drop_vars(tmp_dim) # get associated coordinates with the stacked dim tmp_index = stacked_coord_indices.isel({coord: ~index}).indexes[tmp_dim]