Answers for "remove element from np array"

C
2

remove element from np array

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) #Prints `[1, 2, 5, 6, 8, 9]`
Posted by: Guest on November-19-2020
1

python remove one element from numpy array

numpy.delete(a, index)
Posted by: Guest on March-22-2020

Code answers related to "remove element from np array"

Code answers related to "C"

Browse Popular Code Answers by Language