NumPy: Binary operations routines

Binary operations routines

Elementwise bit operations
Name Description Syntax
bitwise_and() Compute the bit-wise AND of two arrays element-wise. bitwise_and(x1, x2, /[, out, where, …])
bitwise_or() Compute the bit-wise OR of two arrays element-wise. bitwise_or(x1, x2, /[, out, where, casting, …])
bitwise_xor() Compute the bit-wise XOR of two arrays element-wise. bitwise_xor(x1, x2, /[, out, where, …])
invert() Compute bit-wise inversion, or bit-wise NOT, element-wise. invert(x, /[, out, where, casting, order, …])
left_shift() Shift the bits of an integer to the left. left_shift(x1, x2, /[, out, where, casting, …])
right_shift() Shift the bits of an integer to the right. right_shift(x1, x2, /[, out, where, …])
Bit packing
Name Description Syntax
packbits Packs the elements of a binary-valued array into bits in a uint8 array. packbits(myarray[, axis])
unpackbits Unpacks elements of a uint8 array into a binary-valued output array. unpackbits(myarray[, axis])
Output formatting
Name Description Syntax
binary_repr() Convert inputs to arrays with at least one dimension. atleast_1d(*arys)

Previous: rot90()
Next: Binary operations bitwise_and()

Follow us on Facebook and Twitter for latest update.