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.4 Manual
The axis along which to delete the subarray defined by obj. If axis is None, obj is applied to the flattened array. ... A copy of arr with the elements specified by obj removed. Note that delete does not occur in-place.
🌐
Medium
medium.com › @heyamit10 › different-ways-to-remove-elements-from-a-numpy-array-59a8a7f8fe33
Different Ways to Remove Elements from a NumPy Array | by Hey Amit | Medium
April 18, 2025 - When you need to remove more than one element, numpy.delete() lets you pass a list of indices. However, the key here is that these indices must be provided as a list or an 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.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.5.dev0 Manual
The axis along which to delete the subarray defined by obj. If axis is None, obj is applied to the flattened array. ... A copy of arr with the elements specified by obj removed. Note that delete does not occur in-place.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › delete
Python Numpy delete() - Remove Elements | Vultr Docs
November 6, 2024 - Here, elements at indices 1, 3, 5—corresponding to 1, 3, 5 respectively—are deleted from array_md. Specify the axis along which the deletion is to take place: 0 for rows and 1 for columns. Apply the numpy.delete() function with the appropriate ...
🌐
w3resource
w3resource.com › python-exercises › numpy › python-numpy-exercise-89.php
NumPy: Remove specific elements in a NumPy array - w3resource
new_x = np.delete(x, index): Use the np.delete() function to delete the elements from 'x' at the specified indices. The result is a new array 'new_x' with the specified elements removed.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.delete.html
numpy.delete — NumPy v2.2 Manual
The axis along which to delete the subarray defined by obj. If axis is None, obj is applied to the flattened array. ... A copy of arr with the elements specified by obj removed. Note that delete does not occur in-place.
Find elsewhere
🌐
AI Planet
aiplanet.com › learn › introduction-to-numpy › basic-methods-on-array-and-reshaping › 93 › add-remove-and-sort
Add, Remove and Sort | AI Planet (formerly DPhi)
A NumPy array doesn’t support append() method directly on the array. The given snippet will clear this: But a Python list supports append() method directly on the Python list: You can remove an element from an array using delete method of NumPy.
🌐
Data Science Parichay
datascienceparichay.com › home › blog › how to remove elements from a numpy array?
How to remove elements from a numpy array? - Data Science Parichay
June 17, 2022 - You can use the np.delete() function to remove specific elements from a numpy array based on their index. It returns a copy of the array with the required elements deleted.
🌐
Finxter
blog.finxter.com › how-to-remove-specific-elements-in-a-numpy-array
How to Remove Specific Elements in a Numpy Array – Be on the Right Side of Change
Summary: The most straightforward way to remove an element at a given index from a NumPy array is to call the function np.delete(array, index) that returns a new array with the element removed.
🌐
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 - In NumPy, the np.delete() function allows you to delete specific rows, columns, and other elements from an array (ndarray). numpy.delete — NumPy v1.26 Manual Users must specify the target axis (dimen ...
🌐
Statology
statology.org › home › how to remove specific elements from numpy array
How to Remove Specific Elements from NumPy Array
August 2, 2022 - #remove elements whose value is equal to 2, 5, or 12 new_array = np.setdiff1d(original_array, [2, 5, 12]) ... The following examples show how to use each method in practice. The following code shows how to remove all elements from a NumPy array whose value is equal to 12:
🌐
w3resource
w3resource.com › numpy › manipulation › delete.php
NumPy: numpy.delete() function - w3resource
The numpy.delete() function is used to remove one or more elements from an array along a specified axis.
🌐
TutorialsPoint
tutorialspoint.com › home › numpy › numpy delete function
NumPy Delete Function
March 5, 2015 - Following is the basic example of Numpy delete() Function which deletes the element at index 5 − · import numpy as np # Creating an array with shape (3, 4) a = np.arange(12).reshape(3, 4) print('First array:') print(a) print('\n') # Delete ...
🌐
Delft Stack
delftstack.com › home › howto › numpy › numpy remove element from array
How to Remove Elements From Array in NumPy | Delft Stack
February 2, 2024 - Lastly, the axis is an optional argument. axis refers to the axis along which the elements targetted by the obj should be deleted. If a None value is assigned to this parameter, arr is flattened, and deletion is carried out on this flattened array. As usual, if an index that lies outside the range of arr is provided to this method, it throws an IndexError exception. import numpy as np myArray = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) indexes = [3, 5, 7, 34] modifiedArray = np.delete(myArray, indexes) print(modifiedArray)
🌐
Finxter
blog.finxter.com › 5-best-ways-to-remove-elements-from-a-numpy-array
5 Best Ways to Remove Elements from a NumPy Array – Be on the Right Side of Change
This snippet uses a boolean mask to filter out the element “7” from the array arr. The != operator creates the mask, and applying this mask to the array yields the new, desired array without the element. NumPy’s delete() function is explicitly designed for removing elements at specific ...
🌐
DataCamp
datacamp.com › doc › numpy › delete-numpy
NumPy delete()
import numpy as np arr = np.array([1, 2, 3, 4, 5]) new_arr = np.delete(arr, 2) print(new_arr) This example removes the element at index `2` from the 1D array, resulting in `[1, 2, 4, 5]`.
🌐
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 one-dimensional array, this function returns those entries not returned by arr[obj]. ... ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-delete-python
numpy.delete() in Python - GeeksforGeeks
September 14, 2017 - Return: A new NumPy array with the specified elements removed. ... import numpy as np arr = np.arange(5) print("Array:", arr) print("Shape:", arr.shape) # Delete a single element obj = 2 a = np.delete(arr, obj) print("\nDeleting index {}: {}".format(obj, a)) print("Shape:", a.shape) # Delete multiple elements obj = [1, 2] b = np.delete(arr, obj) print("\nDeleting indices {}: {}".format(obj, b)) print("Shape:", b.shape) ... ('Array:', array([0, 1, 2, 3, 4])) ('Shape:', (5,)) Deleting index 2: [0 1 3 4] ('Shape:', (4,)) Deleting indices [1, 2]: [0 3 4] ('Shape:', (3,))