diff --git a/pint/facets/numpy/quantity.py b/pint/facets/numpy/quantity.py index 5257766bc..9039a1f85 100644 --- a/pint/facets/numpy/quantity.py +++ b/pint/facets/numpy/quantity.py @@ -266,7 +266,7 @@ def __setitem__(self, key, value): isinstance(self._magnitude, np.ma.MaskedArray) and np.ma.is_masked(value) and getattr(value, "size", 0) == 1 - ) or math.isnan(value): + ) or (getattr(value, "ndim", 0) == 0 and math.isnan(value)): self._magnitude[key] = value return except TypeError: