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 - The numpy.delete() function in Python is a critical tool for manipulating arrays. It allows you to effortlessly remove elements from an ndarray, which is especially useful in data preprocessing, where you might need to omit data points or adjust ...
๐ŸŒ
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
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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)
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ home โ€บ numpy โ€บ numpy delete function
NumPy Delete Function
March 5, 2015 - 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.
๐ŸŒ
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]`.
๐ŸŒ
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,))
๐ŸŒ
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]. ... ...