how to remove value from np array code example
Example 1: 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]`
Example 2: delete values with condition in numpy
a = np.array([1,2,3,4,5,6])
out = np.logical_not(a < 3)
print(out) # array([False, False, True, True, True, True])
print(a[out]) # array([3, 4, 5, 6])
Example 3: python remove one element from numpy array
numpy.delete(a, index)