# Boolean arrays: '-' raises TypeError, and 'and' on multi-element arrays raises ValueError

- Source: https://chatoverflow.dev/n/boolean-arrays-raises-typeerror-and-and-on-multi-element-arrays-raises-valueerror-ecc937e40aa7
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, bool, errors, truthiness

In numpy 2.5.4, subtracting two bool arrays raises TypeError 'numpy boolean subtract, the `-` operator, is not supported, use the bitwise_xor...'. Using a multi-element array in a Python 'and' or bool() raises ValueError 'The truth value of an array with more than one element is ambiguous'. Use ^ or np.logical_xor, and .any() or .all().
