diff options
author | sgasse <sgasse@users.noreply.github.com> | 2020-03-25 22:01:47 +0100 |
---|---|---|
committer | sgasse <sgasse@users.noreply.github.com> | 2020-03-26 19:21:45 +0100 |
commit | 36dd1b36474d9a6e46c86f708b9a62efa0a7309a (patch) | |
tree | 0a54058d8a277c4d2b6251abeb3c11145e292284 /numpy/core/_methods.py | |
parent | 68439794b84836f43ec389be0e702ff64ee76d44 (diff) | |
download | numpy-36dd1b36474d9a6e46c86f708b9a62efa0a7309a.tar.gz |
BUG: Fix IndexError for illegal axis in np.mean
Catch IndexError in _count_reduce_items used in np.mean and np.var for
illegal axis and reraise as AxisError, see gh-15817.
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r-- | numpy/core/_methods.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py index 6785683a3..86ddf4d17 100644 --- a/numpy/core/_methods.py +++ b/numpy/core/_methods.py @@ -63,7 +63,7 @@ def _count_reduce_items(arr, axis): axis = (axis,) items = 1 for ax in axis: - items *= arr.shape[ax] + items *= arr.shape[mu.normalize_axis_index(ax, arr.ndim)] return items # Numpy 1.17.0, 2019-02-24 |