summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 5453f52fa..2ba223834 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -1027,7 +1027,8 @@ def average(a, axis=None, weights=None, returned=False):
avg = np.multiply(a, wgt, dtype=result_dtype).sum(axis)/scl
if returned:
- scl = np.broadcast_to(scl, avg.shape)
+ if scl.shape != avg.shape:
+ scl = np.broadcast_to(scl, avg.shape).copy()
return avg, scl
else:
return avg