From b7400181a1397d5ac8060bd1aba6d94ade7cbdb0 Mon Sep 17 00:00:00 2001 From: Allan Haldane Date: Mon, 4 Apr 2016 13:04:45 -0400 Subject: MAIN: fix to #7382, make scl in np.average writeable --- numpy/lib/function_base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy/lib/function_base.py') 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 -- cgit v1.2.1