Heli wrote:
[Please don't open a new thread for the same problem]
Providing an example is an improvement over your previous post, but to me
it's still not clear what you want.
>>> functools.reduce(lambda x, y: x | y, (a == i for i in b.flatten()))
array([[ True, True, True],
[ True, True, True],
[False, False, False]], dtype=bool)
produces the desired result for the example input, but how do you want to
handle repeating numbers as in
>>> a = numpy.array([[0,1,2],[3,4,5],[3, 2, 1]])
>>> functools.reduce(lambda x, y: x | y, (a == i for i in b.flatten()))
array([[ True, True, True],
[ True, True, True],
[ True, True, True]], dtype=bool)
?
Try to be clear about your requirement, describe it in english and provide a
bit of context. You might even write a solution that doesn't use numpy and
ask for help in translating it.
At the very least we need more/better examples.