'how to remove a tuple based on its elements when the elements are np.array and my code raises value error "The truth value of an array with more

how to remove a tuple based on its elements when the elements are np.array and my code raises value error: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I want my code to remove the first tuple and leave the 2nd one how can I do this

tuple_list = [(np.array([1,2]),np.array([3,4])),(np.array([5,6]),np.array([7,8]))]
i = np.array([1,2])
j = np.array([3,4])
filtered_t_l =  [ x for x in tuple_list if (x[0], x[1]) != (i,j) ]

expected output:

[(array([5, 6]), array([7, 8]))]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source