Edit
While re-reading the question, I am now almost sure that the OP wants to get a backlink to what I originally posted. Here is how you understand it:
import numpy as np
def selectRow(arr, selrow):
selset = set(selrow)
return np.array([row for row in arr if selset == set(row)])
arr = np.array([
[1,2,3],
[4,5,6],
[7,8,9],
[3,2,1]
])
selectRow(arr, [1,2,3])
:
array([[1, 2, 3],
[3, 2, 1]])
, , .
:
import numpy as np
def withoutRow(arr, badrow):
return np.array([row for row in arr if not np.array_equal(row, badrow)])
:
arr = np.array([
[1,2,3],
[4,5,6],
[7,8,9],
[3,2,1]
])
withoutRow(arr, [1,2,3])
:
array([[4, 5, 6],
[7, 8, 9],
[3, 2, 1]])
withoutRow ( ), ( ), ( ).
, :
def withoutRowUnordered(arr, badrow):
badset = set(badrow)
return np.array([row for row in arr if badset != set(row)])
withoutRowUnordered(arr, [1,2,3])
:
array([[4, 5, 6],
[7, 8, 9]])