Tips (Utility, Computer Language, and etc.)
[python] array에서 특정 값을 가지는 위치 반환 np.where(condition)
Struggler J.
2018. 1. 5. 02:36
import numpy as np
zeroidx = np.where(norm<=0)
#모든 해당 위치를 1로 바꾸고 싶으면 아래와 같이 적어주면 된다.
norm[zeroidx] = 1