Contents
- NumPy - 수학/과학 연산을 위한 파이썬 패키지
- NumPy 기초
- NumPy 어레이 만들기
- NumPy 어레이 출력하기
- NumPy 기본 연산
- NumPy 범용 함수 (ufunc)
- NumPy 인덱싱/슬라이싱/이터레이팅
- NumPy 어레이 형태 다루기
- NumPy 난수 생성 (Random 모듈)
- NumPy 다양한 함수들
- numpy.absolute
- numpy.add
- numpy.allclose
- numpy.amax
- numpy.amin
- numpy.append
- numpy.arange
- numpy.arccos
- numpy.arccosh
- numpy.arcsin
- numpy.arcsinh
- numpy.arctan
- numpy.arctanh
- numpy.argmax
- numpy.argsort
- numpy.around
- numpy.array_equal
- numpy.array
- numpy.cbrt
- numpy.ceil
- numpy.clip
- numpy.concatenate
- numpy.copy
- numpy.cos
- numpy.cosh
- numpy.deg2rad
- numpy.delete
- numpy.digitize
- numpy.divide
- numpy.dot
- numpy.empty_like
- numpy.empty
- numpy.equal
- numpy.exp
- numpy.exp2
- numpy.expm1
- numpy.fabs
- numpy.fix
- numpy.floor_divide
- numpy.floor
- numpy.full_like
- numpy.full
- numpy.greater_equal
- numpy.greater
- numpy.identity
- numpy.insert
- numpy.isclose
- numpy.less_equal
- numpy.less
- numpy.linspace
- numpy.loadtxt
- numpy.log
- numpy.log1p
- numpy.log2
- numpy.log10
- numpy.matmul
- numpy.mean
- numpy.mod
- numpy.multiply
- numpy.ndarray.flatten
- numpy.ndarray.shape
- numpy.negative
- numpy.nonzero
- numpy.not_equal
- numpy.ones_like
- numpy.ones
- numpy.polyfit
- numpy.positive
- numpy.power
- numpy.rad2deg
- numpy.random.rand
- numpy.random.randint
- numpy.random.randn
- numpy.random.seed
- numpy.random.standard_normal
- numpy.reciprocal
- numpy.remainder
- numpy.repeat
- numpy.reshape
- numpy.rint
- numpy.round_
- numpy.savetxt
- numpy.set_printoptions
- numpy.sign
- numpy.sin
- numpy.sinh
- numpy.sqrt
- numpy.square
- numpy.std
- numpy.subtract
- numpy.sum
- numpy.take
- numpy.tan
- numpy.tanh
- numpy.tile
- numpy.transpose
- numpy.tril
- numpy.triu
- numpy.true_divide
- numpy.trunc
- numpy.var
- numpy.where
- numpy.zeros_like
- numpy.zeros
- NumPy 상수
Tutorials
- Python Tutorial
- NumPy Tutorial
- Matplotlib Tutorial
- PyQt5 Tutorial
- BeautifulSoup Tutorial
- xlrd/xlwt Tutorial
- Pillow Tutorial
- Googletrans Tutorial
- PyWin32 Tutorial
- PyAutoGUI Tutorial
- Pyperclip Tutorial
- TensorFlow Tutorial
- Tips and Examples
numpy.reshape¶
numpy.reshape 함수는 어레이를 지정한 형태로 변환합니다.
예제¶
import numpy as np
a = np.arange(12)
b = a.reshape(3, 4)
c = a.reshape(2, 3, 2)
print(a)
print(b)
print(b.shape, b.ndim)
print(c)
print(c.shape, c.ndim)
[ 0 1 2 3 4 5 6 7 8 9 10 11]
[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]]
(3, 4) 2
[[[ 0 1]
[ 2 3]
[ 4 5]]
[[ 6 7]
[ 8 9]
[10 11]]]
(2, 3, 2) 3
1차원 어레이 a를 numpy.reshape()을 이용해서
(3, 4)의 형태를 갖는 2차원 어레이 그리고 (2, 3, 2) 형태를 갖는 3차원 어레이로 변환했습니다.
ndarray 객체의 shape, ndim 속성을 이용해서 어레이의 형태와 차원을 확인할 수 있습니다.
관련 페이지¶
이전글/다음글
이전글 : numpy.repeat
다음글 : numpy.rint