diff --git a/astropy/utils/masked/core.py b/astropy/utils/masked/core.py index 223bdf69f15..92442b059c1 100644 --- a/astropy/utils/masked/core.py +++ b/astropy/utils/masked/core.py @@ -1302,7 +1302,6 @@ def mean(self, axis=None, dtype=None, out=None, keepdims=False, *, where=True): n = np.add.reduce(where, axis=axis, keepdims=keepdims) # catch the case when an axis is fully masked to prevent div by zero: - n = np.add.reduce(where, axis=axis, keepdims=keepdims) neq0 = n == 0 n += neq0 result /= n