EDIT: added condition for the specific column to check
You don't need to use any apply methods for this. It can be solved with basic boolean indexing as follows -
arr[~(arr[:,col] == val),:]
arr[:,col] selects the specific column from array
arr[:,col] == val checks for the value and returns True where it exists, else False
~(arr[:,col] == val) inverses the True and False
arr[~(arr[:,col] == val),:] keeps only the rows which have the boolean index as True and discards all False
Example solution
arr = np.array([[12, 10, 12, 0, 9, 4, 12, 11],
[ 3, 10, 14, 5, 4, 3, 6, 6],
[12, 10, 1, 0, 5, 7, 5, 10],
[12, 8, 14, 14, 12, 3, 14, 10],
[ 9, 14, 3, 8, 1, 10, 9, 6],
[10, 3, 11, 3, 12, 13, 11, 10],
[ 0, 6, 8, 8, 5, 5, 1, 10], #<- this to remove
[13, 6, 1, 10, 7, 10, 10, 13],
[ 3, 3, 8, 10, 13, 0, 0, 10], #<- this to remove
[ 6, 2, 13, 5, 8, 2, 8, 10]])
# ^
# this column to check
#boolean indexing approach
val, col = 8,2 #value to check is 8 and column to check is 2
out = arr[~(arr[:,col] == val),:] #<-----
out
array([[12, 10, 12, 0, 9, 4, 12, 11],
[ 3, 10, 14, 5, 4, 3, 6, 6],
[12, 10, 1, 0, 5, 7, 5, 10],
[12, 8, 14, 14, 12, 3, 14, 10],
[ 9, 14, 3, 8, 1, 10, 9, 6],
[10, 3, 11, 3, 12, 13, 11, 10],
[13, 6, 1, 10, 7, 10, 10, 13],
[ 6, 2, 13, 5, 8, 2, 8, 10]])
If you want to check for the value in all columns then try this -
arr[~(arr == val).any(1),:]
And if you want to keep ONLY rows with the value instead, just remove ~ from the condition.
arr[(arr[:,col] == val),:]
If you want to remove the column as well, using np.delete -
np.delete(arr[~(arr[:,col] == val),], col, axis=1)
Note: You cannot remove both rows and columns at once using np.delete so if you plan to use it, you will need to do np.delete two times once for axis = 0 (rows) and once for axis = 1 (columns)
arr[~(arr == val).any(1),:]which is equal to checking for the value in the matrix, and then checking which rows have atleast one instance of the value usingany, then inversing the Trues and False to finally filter. Check my answer for details.