I'm facing a simple problem where I have to delete elements from a 2-dimensional NumPy array-like m. When I try to remove an element at a certain index with delete() function, it just doesn't perform the deletion.
import numpy as np
m = np.array([[1], [1], [3]])
np.delete(m, 2)
print(m)
This code is supposed to output [[1], [1]], as it's deleting the element at index 2. But the actual output it gives is the same original array [[1] [1] [3]].
- Why is this function not working?
- And how can I solve it without converting the NumPy array to a Python list?