If you have array = np.array([1,2,3,4])
and you have index = np.array([0,1,2])
and you want to remove the index elements in array, what's the best way to do this without looping?
You use numpy.delete
:
smaller_array = np.delete(array,index)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With