python – Inverting a numpy boolean array using ~

python – Inverting a numpy boolean array using ~

short answer: YES

Ref:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.invert.html

Notice:

Computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator ~.

and

bitwise_not is an alias for invert:

>> np.bitwise_not is np.invert
>> True

python – Inverting a numpy boolean array using ~

Leave a Reply

Your email address will not be published.