One approach with boolean-indexing would be -

mask = np.in1d(np.arange(A.size),B)
out = np.r_[A[mask], A[~mask]]

Sample run -

In [26]: A = np.array([ 1, 2, 5, 9.8, 55, 3])

In [27]: B = np.array([ 3, 4])

In [28]: mask = np.in1d(np.arange(A.size),B)

In [29]: np.r_[A[mask], A[~mask]]
Out[29]: array([  9.8,  55. ,   1. ,   2. ,   5. ,   3. ])

Another with integer-indexing -

idx = np.setdiff1d(np.arange(A.size),B)
out = np.r_[A[B], A[idx]]

Sample run -

In [36]: idx = np.setdiff1d(np.arange(A.size),B)

In [37]: np.r_[A[B], A[idx]]
Out[37]: array([  9.8,  55. ,   1. ,   2. ,   5. ,   3. ])
Answer from Divakar on Stack Overflow
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.5 Manual
>>> import numpy as np >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) >>> arr array([[ 1, 2, 3, 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12]]) >>> np.delete(arr, 1, 0) array([[ 1, 2, 3, 4], [ 9, 10, 11, 12]])
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.3 Manual
>>> import numpy as np >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) >>> arr array([[ 1, 2, 3, 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12]]) >>> np.delete(arr, 1, 0) array([[ 1, 2, 3, 4], [ 9, 10, 11, 12]])
🌐
Stack Overflow
stackoverflow.com › questions › 48616556 › delete-an-subarray-from-an-numpy-array-or-replace-that-subarray-elements-with-0
python - delete an subarray from an numpy array or replace that subarray elements with 0 - Stack Overflow
February 5, 2018 - I have an array 'a' and i am creating a subarray with selecting certain row and columns, and calling it an array 'b'. How am i suppose to delete or replace those elements in 'a' which is same as elements in 'b'? def seat(): print("select your seat") import numpy as np a = np.arange(100).reshape(10, 10) print(a) l1=input("enter row number:") l1=int(l1) l=l1-1 n1=input("enter the from column number:") n1=int(n1) n=n1-1 p1=input("enter the to column number:") p1=int(p1) p=p1+1 b=a[l:, n:p] k=b.size print("you have booked "+str(k)+"tickets") for element in b.flat: print("your ticket numbers are:"+ str(element)) if a.size==0: print("there are no tickets left") return k;
🌐
TutorialsPoint
tutorialspoint.com › numpy › numpy_delete.htm
Numpy delete() Function
The Numpy delete() Function is used to return a new array with the specified subarray deleted from the input array. If the axis parameter is not provided then the input array is flattened before deletion.
🌐
Stack Overflow
stackoverflow.com › questions › 40143044 › removing-a-subarray-after-using-numpy-split
python - Removing a subarray after using numpy.split - Stack Overflow
October 20, 2016 - #A is some mxn matrix numfolds=5 folds = numpy.split(A,numfolds) #now folds is 5 equalish subarrays which can be called out #subarray1 is the second fold (the second fifth of A along axis=0 by default) subarray1 = folds[2] #numpy.delete does not get rid of the second subarray in A arrayWithoutSubArray1 = numpy.concatenate(numpy.delete(folds[2]))
🌐
Appsloveworld
appsloveworld.com › numpy › 100 › 61 › removing-subarray-from-array
[Solution]-Removing subarray from array-numpy
A bit confused, pretty sure i'm missing something here: Indexed array with an element from different array? Numpy ValueError: setting an array element with a sequence reading in list · Putting a gap/break in a pyplot line plot without losing data ... Non-numpy answer. A = [ 1, 2, 5, 9.8, 55, 3] B = [ 3, 4] new_arr = [A[i] for i in B if i<len(A)] + [A[i] for i in range(len(A)) if i not in set(B)] # [9.8, 55, 1, 2, 5, 3] You may remove the extra check if i<len(A) if you are sure about it.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.2 Manual
>>> import numpy as np >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) >>> arr array([[ 1, 2, 3, 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12]]) >>> np.delete(arr, 1, 0) array([[ 1, 2, 3, 4], [ 9, 10, 11, 12]])
Find elsewhere
🌐
w3resource
w3resource.com › numpy › manipulation › delete.php
NumPy: numpy.delete() function - w3resource
April 25, 2026 - NumPy Array manipulation: numpy.delete() function, example - Return a new array with sub-arrays along an axis deleted. For a one dimensional array, this returns those entries not returned by arr[obj].
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.0 Manual
>>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) >>> arr array([[ 1, 2, 3, 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12]]) >>> np.delete(arr, 1, 0) array([[ 1, 2, 3, 4], [ 9, 10, 11, 12]])
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.6.dev0 Manual
>>> import numpy as np >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) >>> arr array([[ 1, 2, 3, 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12]]) >>> np.delete(arr, 1, 0) array([[ 1, 2, 3, 4], [ 9, 10, 11, 12]])
🌐
Educative
educative.io › answers › what-is-the-numpydelete-function-in-python
What is the numpy.delete() function in Python?
The delete() function in Python is used to delete the sub-arrays of a given array along a specified axis.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-delete-python
numpy.delete() in Python - GeeksforGeeks
January 23, 2026 - The numpy.delete() function returns a new array with the deletion of sub-arrays along with the mentioned axis. ... Here, the element at index 1 is removed from the array.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-remove-specific-elements-from-a-numpy-array
How to remove specific elements from a NumPy array ? - GeeksforGeeks
July 23, 2025 - # import numpy as np import numpy as np # create an array with 5 # elements a = np.array([1, 2, 3, 4, 5]) # display a print(a) # delete 1st element and 5th element print("remaining elements after deleting 1st and last element ", np.delete(a, [0, 4])) ... Removing 8 values from an array.