넘파이 resize

파이썬・ML/numpy

넘파이 배열의 형태 조작하기(reshape/resize)

이번 포스팅에서는 넘파이 배열의 형태를 조작하는 reshape, resize 메서드에 대해 알아보도록 하겠습니다. import numpy as np reshape 메서드 - np.reshape(a, newshape, ...) - ndarray.reshape(shape, ...) arr1 = np.arange(6) print(arr1) # [0 1 2 3 4 5] print(arr1.shape) # (6, ) print(arr1.size) # 6 arr2 = np.reshape(arr1, (2, 4)) # ValueError: cannot reshape array of size 6 into shape (2,4) reshape 메서드는 기존 배열의 형태를 변환합니다. 단, 변환 전과 후의 size 속성값이 ..

truezero
'넘파이 resize' 태그의 글 목록