summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2016-04-04 13:04:45 -0400
committerAllan Haldane <allan.haldane@gmail.com>2016-04-04 13:04:45 -0400
commitb7400181a1397d5ac8060bd1aba6d94ade7cbdb0 (patch)
treebfc3af464bc3ca6d7cf8256ffb713b0fb251a0e9 /numpy/lib/function_base.py
parent6ab89b8c66f68dfac9fde6eab843990a732a9a27 (diff)
downloadnumpy-b7400181a1397d5ac8060bd1aba6d94ade7cbdb0.tar.gz
MAIN: fix to #7382, make scl in np.average writeable
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