Python
numpy

The sample of index using True or Flase array

print("====intro.====")
A = np.arange(0,9,3)
print(A)
B = A[[False, True, True, False, False,True]]
print(B)

Z = np.random.randint(0,5,(10,3))
print(Z)
# solution for arrays of all dtypes (including string arrays and record arrays)
print("====all====")
A = Z[:,1:]
B = Z[:,:-1]
print(A)
print(B)
E = np.all(A == B, axis=1)
print(E)
print("====U====")
U = Z[~E]
print(U)
  • e.g.
====intro.====
[0 3 6]
[0 3 3 0 0 3]
[[0 1 1]
 [2 4 0]
 [1 3 4]
 [0 4 3]
 [1 0 3]
 [3 3 0]
 [4 3 4]
 [2 2 2]
 [4 2 2]
 [1 2 0]]
====all====
[[1 1]
 [4 0]
 [3 4]
 [4 3]
 [0 3]
 [3 0]
 [3 4]
 [2 2]
 [2 2]
 [2 0]]
[[0 1]
 [2 4]
 [1 3]
 [0 4]
 [1 0]
 [3 3]
 [4 3]
 [2 2]
 [4 2]
 [1 2]]
[False False False False False False False  True False False]
====U====
[[0 1 1]
 [2 4 0]
 [1 3 4]
 [0 4 3]
 [1 0 3]
 [3 3 0]
 [4 3 4]
 [4 2 2]
 [1 2 0]]

Refs.