I want to initialize a numpy array of size (n,m) that can only contain zeros or ones. Furthermore, I want to later to np.bitwise_or with the array.
For example, If I try:
import numpy as np
myArray = np.zeros([4,4])
myRow = myArray[1,]
myCol = myArray[,1]
np.bitwise_or(myRow, myCol)
It fails:
TypeError: ufunc 'bitwise_or' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
How can I do this in a similar manner but without errors?
If I try,
np.bitwise_or([0,0,0,0], [0,0,0,0])
it actually works.