Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
いくつかのnumpy配列aを使用して、私がやりたいことは
indices = np.where((a < 4) or (a > 12))
これは無効です。「複数の要素を持つ配列の真の値があいまいです。a.any() または a.all() を使用してください」を返すだけです。しかし、この表現は曖昧ではなく、やりたいことをやらないでくださいany。all(anyそして、all複合式を取ることもできません。しかし、ifできます。混乱しています...)
any
all
if
の引数として論理/ブール配列を取得したいwhere
where
x | yまたはnp.logical_or(x,y)、どこで、どこxにいyてa < 4、a > 12
x | y
np.logical_or(x,y)
x
y
a < 4
a > 12