여기 Python noobie :) 사물을 간결하게 처리하는 방법을 찾으려합니다.0이 아닌 경우 ndarray의 모든 요소에 1을 추가하십시오.
>>> f = np.zeros((2,2), dtype=int)
>>> f[0][1] = 100
>>> f[1][0] = 200
>>> print f
[[ 0 100]
[200 0]]
>>> f1 = # do something special
>>> print f1
[[ 0 101]
[201 0]]
고마워요!
원하는 [마스크 배열] (http://docs.scipy.org/doc/numpy/reference/maskedarray.html). 구체적으로 [masked where] (http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.masked_where.html). – will