For example, I want, given the list
given_list = [np.array([1,44,21,2])]
Check if this list contains another numpy array, for example np.array([21,4,1,21])
I tried this but it checks if each element of the numpy array is the equal to the new numpy array
import numpy as np
given_list = [np.array([1,44,21,2])]
new_elem = np.array([21,4,1,21])
print([new_elem==elem for elem in given_list])
I would like to receive '[False]', but instead I get '[array([False, False, False, False])]'.
I don't understand why given_list is identified as a numpy array and not as a list of one numpy array.
==operator it will compare by elements. I just executedprint(np.ones(4) == np.arange(4))and it gives[False True False False]given_listand comparing arrays. Nothing is treating the list as an array.