FunctionA numpy, , , numpy.where:
x = np.arange(16).reshape((2, 8))
y = np.array([[2], [13]])
z = np.arange(16, 32).reshape((2, 8))
numpy.where(~(x > y).any(axis=0), x, z)
:
array([[ 0, 1, 2, 19, 20, 21, 22, 23],
[ 8, 9, 10, 27, 28, 29, 30, 31]])
, , , z , x. z , True ~(x > y).any(axis=0), , .
, , , z, . , , , :
x[:,(x > y).any(axis=0)] = z.T
:
>>> z = np.arange(20, 30).reshape((5, 2))
>>> x[:,(x > y).any(axis=0)] = z.T
>>> x
array([[ 0, 1, 2, 20, 22, 24, 26, 28],
[ 8, 9, 10, 21, 23, 25, 27, 29]])