I've got a numpy array and would like to remove some columns based on index. Is there an in-built function for it or some elegant way for such an operation?
Something like:
arr = [234, 235, 23, 6, 3, 6, 23]
elim = [3, 5, 6]
arr = arr.drop[elim]
output: [234, 235, 23, 3]
use numpy.delete
, it will return a new array:
import numpy as np
arr = np.array([234, 235, 23, 6, 3, 6, 23])
elim = [3, 5, 6]
np.delete(arr, elim)
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