diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index a5f6376d399..7cc0b92ce8e 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2912,7 +2912,7 @@ def reduce(self, func, dim=None, keep_attrs=None, numeric_only=False, else: dims = set(dim) - missing_dimensions = [dim for d in dims if d not in self.dims] + missing_dimensions = [d for d in dims if d not in self.dims] if missing_dimensions: raise ValueError('Dataset does not contain the dimensions: %s' % missing_dimensions) @@ -3711,7 +3711,7 @@ def quantile(self, q, dim=None, interpolation='linear', else: dims = set(dim) - _assert_empty([dim for d in dims if d not in self.dims], + _assert_empty([d for d in dims if d not in self.dims], 'Dataset does not contain the dimensions: %s') q = np.asarray(q, dtype=np.float64)