I have something similar to the following code:
list1 = [(13,120), (25, 254), (25, 125), (189, 11), ....]
list2 = [ list(el) for el in list1]
arr = np.array(list2)
Let's say list1
has a length of 100 and hence, arr
has a shape (100, 2)
tuple_list = some tuple list where tuple size is 2 i.e [(5, 56), (254, 23), (22, 22), ...]
count_list = 0
count_arr = 0
for tup in tuple_list:
if tup in list1:
count_list += 1
if list(tup) in arr:
count_arr += 1
I expected count_list
and count_arr
to be equal but they are showing different values. So my question is how does in
work for list
and ndarray
?