[Numpy] ndarray를 알아보자2(reshape, resize,copy,view)
이번 글에서는 ndarray의 reshape , resize, copy, view에 대해 알아보도록 하겠습니다. 1. numpy.reshape(a,newshape,order='c') np.reshape은 원하는 tensor의 형태로 변환해주는 API입니다. 아래는 shape (,6) 을 shape (2,3)으로 변환해주는 예시 코드와 결괏값입니다. import numpy as np a= np.arange(6) b= np.reshape(a,(2,3)) print("original ndarray: \n",a) print("reshaped ndarray: \n",b) original ndarray: [0 1 2 3 4 5] reshaped ndarray: [[0 1 2] [3 4 5]] print("origi..
[Numpy] ndarray에 대해
이번 글에서는 Numpy의 ndarray에 대해서 알아보겠습니다. Reference - numpy공식 문서 https://numpy.org/doc/stable/reference/arrays.ndarray.html The N-dimensional array (ndarray) — NumPy v1.21 Manual Arithmetic and comparison operations on ndarrays are defined as element-wise operations, and generally yield ndarray objects as results. Each of the arithmetic operations (+, -, *, /, //, %, divmod(), ** or pow(), , &, ^, |,..