0
ゼロ(0)または1だけを含むことができるサイズ(n、m)のnumpy配列を初期化したいとします。 さらに、後でnp.bitwise_orまたは配列を使用したいと思います。例えばndarraysのnp.ndarray bitwise_or演算子が失敗します
は、私がしようとした場合:
import numpy as np
myArray = np.zeros([4,4])
myRow = myArray[1,]
myCol = myArray[,1]
np.bitwise_or(myRow, myCol)
それは失敗します。
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''
がどのように私は同様の方法でなく、エラーなしでこれを行うことができますか?
私がしようとした場合、
np.bitwise_or([0,0,0,0], [0,0,0,0])
それが実際に動作します。