diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-04-04 21:52:28 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2016-04-04 21:52:28 -0600 |
commit | 9c59de6e5771174dec5487a25d7594e4021669d6 (patch) | |
tree | 98abc28f7cf8d321d1d5670732fee96b386f2325 /numpy/lib/function_base.py | |
parent | b2d5a7b89a64f2eb491e88a67a155a4e9ab6ff1b (diff) | |
parent | b7400181a1397d5ac8060bd1aba6d94ade7cbdb0 (diff) | |
download | numpy-9c59de6e5771174dec5487a25d7594e4021669d6.tar.gz |
Merge pull request #7505 from ahaldane/fixup_7382
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.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 77fe5cef2..b119f667a 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 |