I have a small list:
list2 = ['hi', 'ma', 'ja']
and I have a matrix too. for example:
matrix2 = ([['high','h ight','hi ght','h i g ht'],
['man','ma n','ma th','mat h'],
['ja cket','j a ck et','jack et','ja m']
['ma nkind','jack',' hi ','hi'])
And I need to determine if any of the elements of l ist2 of this array are not in the matrix2. I try to use np.isin() :
np.isin(matrix2,list2)
But this code only shows if there is the elements in the matrix or not completely. But I need this output:
output = ([[False, False, True, False],
[False, True, True, False],
[True, False, False, True]
[True, False, True, False])])
As you can see in the output, the spaces are important too. For example, 'hi' without space before and after it is not something that I want it. I need the list by considering spaces between the set of characters.
Could anyone help me to solve this problem?