# 화소(행렬 원소) 접근importnumpyasnpmat=np.arange(10).reshape(2,5)print("원소 처리 전: mat = ",mat,sep="\n")print("mat.shape = ",mat.shape)print("-"*50)# 효율적인 접근 방법mat=mat*2# mat *= 2print("원소 처리 후: mat = ",mat,sep="\n")print("-"*50)
원소 처리 전: mat =
[[0 1 2 3 4]
[5 6 7 8 9]]
mat.shape = (2, 5)
--------------------------------------------------
원소 처리 후: mat =
[[ 0 2 4 6 8]
[10 12 14 16 18]]
--------------------------------------------------