diff options
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r-- | numpy/core/_methods.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py index 8f0027616..c8a968c97 100644 --- a/numpy/core/_methods.py +++ b/numpy/core/_methods.py @@ -91,8 +91,9 @@ def _var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False): arrmean = arrmean.dtype.type(arrmean / rcount) # Compute sum of squared deviations from mean - # Note that x may not be inexact - x = arr - arrmean + # Note that x may not be inexact and that we need it to be an array, + # not a scalar. + x = asanyarray(arr - arrmean) if issubclass(arr.dtype.type, nt.complexfloating): x = um.multiply(x, um.conjugate(x), out=x).real else: |