I have a numpy array
a = ([[1,2,3],
[2,2,2],
[1,5,3],
[3,3,1]])
swap1 = [2,2,2]
swap2 = [3,3,1]
I want to swap the rows which are equal to swap1 and swap2 without being aware of the index of these 2 rows. I want the output to look like this
Out = ([[1,2,3],
[3,3,1],
[1,5,3],
[2,2,2]])
What would be the best way to do this? I want to avoid loops if that's an option. Thanks!