Overview:
-
Given two numpy array-like instances the bitwise_XOR() function works pairwise on the integer/Boolean elements from each instance and performs exclusive OR operation returning the results as an ndarray. One of the parameters could also be a numpy scalar. When the input are of different dimensions the numpy broadcasting rules are applied.
-
Bitwise exclusive OR operation on two integer operands compares each pair of bits and returns 1, only if both the bits are different i.e., mutually exclusive. The result of the exclusive OR operation is zero, when the pair of bits from the operands are both zero or both one.
Example:
# Example Python program that applies # To convert decimal numbers of the ndarray to binary numbers # Create ndarrays of numbers and masks # Populate the numbers # Populate the masks # Apply bitwise_xor() print("Numbers:") |
Output:
Numbers: |