Use numpy.delete(), which returns a new array with sub-arrays along an axis deleted.

numpy.delete(a, index)

For your specific question:

import numpy as np

a = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])
index = [2, 3, 6]

new_a = np.delete(a, index)

print(new_a)
# Output: [1, 2, 5, 6, 8, 9]

Note that numpy.delete() returns a new array since array scalars are immutable, similar to strings in Python, so each time a change is made to it, a new object is created. I.e., to quote the delete() docs:

"A copy of arr with the elements specified by obj removed. Note that delete does not occur in-place..."

If the code I post has output, it is the result of running the code.

Answer from Levon on Stack Overflow
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.5 Manual
Is equivalent to np.delete(arr, [0,2,4], axis=0), but allows further use of mask. ... Try it in your browser! >>> 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]])
🌐
thisPointer
thispointer.com › home › numpy › delete elements from a numpy array by value or conditions in python
Delete elements from a Numpy Array by value or conditions in Python - thisPointer
May 10, 2023 - Now suppose we want to delete all occurrences of 6 from the above numpy array. Let’s see how to do that, # Remove all occurrences of elements with value 6 from numpy array arr = arr[arr != 6] print('Modified Numpy Array by deleting all occurrences of 6') print(arr)
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.2 Manual
Is equivalent to np.delete(arr, [0,2,4], axis=0), but allows further use of mask. ... >>> 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]])
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Delete rows/columns from an array with np.delete() | note.nkmk.me
February 5, 2024 - Multiple rows and columns can be deleted at once by specifying a list or a slice in the second argument obj. Specify the row or column numbers with a list. a = np.arange(12).reshape(3, 4) print(a) # [[ 0 1 2 3] # [ 4 5 6 7] # [ 8 9 10 11]] print(np.delete(a, [0, 2], 0)) # [[4 5 6 7]] print(np.delete(a, [0, 3], 1)) # [[ 1 2] # [ 5 6] # [ 9 10]] ... Starting from NumPy version 1.19, a list or array of Boolean values can be treated as a mask, with the indexes corresponding to True being deleted.
🌐
Programiz
programiz.com › python-programming › numpy › methods › delete
NumPy delete()
The delete() method deletes the values at specified indices. import numpy as np array1 = np.array([0, 1, 2, 3]) # delete at index 2 array2 = np.delete(array1, 2) print(array2) # Output: [0 1 3] ... Note: By default, axis is None, and the array is flattened.
🌐
DataCamp
datacamp.com › doc › numpy › delete-numpy
NumPy delete()
Note: The `obj` parameter can be an integer, a list of integers, or a slice object. The `np.delete()` function does not operate in-place; it returns a new array and leaves the original array unmodified. import numpy as np arr = np.array([1, 2, 3, 4, 5]) new_arr = np.delete(arr, 2) print(new_arr)
Find elsewhere
🌐
w3resource
w3resource.com › numpy › manipulation › delete.php
NumPy: numpy.delete() function - w3resource
April 25, 2026 - In the second example, np.delete(arr, [1, 2, 5], None) removes the elements with indices 1, 2, and 5 from the arr array along both rows and columns because the None argument is used for the second argument, which means the operation is performed ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python numpy delete() function
Python NumPy delete() Function - Spark By {Examples}
March 27, 2024 - Python NumPy delete() function is used to delete elements based on index positions, and it returns a new array with the specified elements removed. For a
🌐
Medium
medium.com › @heyamit10 › numpy-delete-in-numpy-90ffd785a5cf
Understanding numpy.delete() with Syntax and Parameters | by Hey Amit | Medium
February 8, 2025 - At its core, numpy.delete() is a simple tool to remove specific elements, rows, or columns from a NumPy array. But here's the best part—it doesn’t mess with your original array!
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.6.dev0 Manual
Is equivalent to np.delete(arr, [0,2,4], axis=0), but allows further use of mask. ... Try it in your browser! >>> 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]])
🌐
Statology
statology.org › home › how to remove specific elements from numpy array
How to Remove Specific Elements from NumPy Array
August 2, 2022 - by Zach Bobbitt Published on Published on August 2, 2022 · You can use the following methods to remove specific elements from a NumPy array: Method 1: Remove Elements Equal to Specific Value · #remove elements whose value is equal to 12 new_array ...
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.0 Manual
>>> np.delete(arr, np.s_[::2], 1) array([[ 2, 4], [ 6, 8], [10, 12]]) >>> np.delete(arr, [1,3,5], None) array([ 1, 3, 5, 7, 8, 9, 10, 11, 12])
🌐
TutorialsPoint
tutorialspoint.com › numpy › numpy_delete.htm
Numpy delete() Function
Here in this example we are deleting a specific column from a 2D array with the help of delete() function − · import numpy as np # Create a 3x4 array a = np.arange(12).reshape(3, 4) print('Original array:') print(a) print('\n') # Delete the ...
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-remove-specific-elements-from-a-numpy-array
How to remove specific elements from a NumPy array ? - GeeksforGeeks
September 12, 2022 - For doing our task, we will need some inbuilt methods provided by the NumPy module which are as follows: np.delete(ndarray, index, axis): Delete items of rows or columns from the NumPy array based on g · 3 min read How to remove NaN values from a given NumPy array?