summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-03-22 14:38:55 +0000
committerEric Wieser <wieser.eric@gmail.com>2020-03-22 14:38:55 +0000
commit90e644e7c668d52155e9a07b1032e71974e3dc7d (patch)
treeeac192659eac574f3a3244a2b7f3302371286793 /numpy/lib/function_base.py
parent566c84bfda3ac656232600445442cdf74bc84569 (diff)
downloadnumpy-90e644e7c668d52155e9a07b1032e71974e3dc7d.tar.gz
MAINT: Make the axis logic for delete match insert.
No behavior change here unless someone implements a subclass where `arr.ravel().ndim == 0`, which no sane person would do anyway.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 6c7786860..1c67f7c99 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -4272,9 +4272,8 @@ def delete(arr, obj, axis=None):
arr = arr.ravel()
# needed for np.matrix, which is still not 1d after being ravelled
ndim = arr.ndim
- axis = -1
-
- if ndim == 0:
+ axis = ndim - 1
+ elif ndim == 0:
# 2013-09-24, 1.9
warnings.warn(
"in the future the special handling of scalars will be removed "
@@ -4283,8 +4282,8 @@ def delete(arr, obj, axis=None):
return wrap(arr)
else:
return arr.copy(order=arrorder)
-
- axis = normalize_axis_index(axis, ndim)
+ else:
+ axis = normalize_axis_index(axis, ndim)
slobj = [slice(None)]*ndim
N = arr.shape[axis]