summaryrefslogtreecommitdiff
path: root/numpy/core/_methods.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r--numpy/core/_methods.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py
index e475b94df..a239e2c87 100644
--- a/numpy/core/_methods.py
+++ b/numpy/core/_methods.py
@@ -221,8 +221,10 @@ def _var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False, *,
if isinstance(arrmean, mu.ndarray):
arrmean = um.true_divide(arrmean, div, out=arrmean, casting='unsafe',
subok=False)
- else:
+ elif hasattr(arrmean, "dtype"):
arrmean = arrmean.dtype.type(arrmean / rcount)
+ else:
+ arrmean = arrmean / rcount
# Compute sum of squared deviations from mean
# Note that x may not be inexact and that we need it to be an array,