I have multiple bool np.ndarray of same shape, e.g.:
a1 = [T, F, F]
a2 = [F, F, T]
a3 = [F, T, F]
How can I apply the or operation maybe something like this and get the result [T, T, T]?
res = Or([a1, a2, a3])
If I understand correctly, you want this:
a1 = [True, False, False]
a2 = [False, False, True]
a3 = [False, True, False]
res = np.vstack([a1,a2,a3]).any(axis=0)
or equally:
res = np.logical_or.reduce([a1,a2,a3])
(I expect reduce to be faster or similar performance as stack). There are also many more ways to achieve this. I expect these to be faster than others.
output:
[ True True True]