In numpy, if I have an array of floats, dynamically create a boolean mask of where this array equals a particular value and do a bitwise AND with a boolean array, I get an e
& has higher precedence than ==, so the expression
&
==
a == 2.0 & b
is the same as
a == (2.0 & b)
You get the error because bitwise and is not defined for a floating point scalar and a boolean array.
and
Add parentheses to get what you expected:
(a == 2.0) & b