Numpy : np.reshape, flatten, ravel, newaxis (차원 변경)
reshape A = np.array([1,2,3,4,5,6]) A.reshape(3,2) # A.reshape(-1,1) 위와 같은 것, -1은 열의 갯수에 맞춰서 행 갯수를 자동으로 정하는 것. """ [[1,2], [3,4], [5,6]] """ flatten, ravel A.flatten() # A.ravel() A A.shape """ [1,2,3,4,5,6] """ newaxis A[:, np.newaxis] """ array([[1], [2], [3], [4], [5], [6]]) """ meshgrid points = np.arange(-5,5,0.01) xs,ys = np.meshgrid(points, points) xs """ [[-5, -4.99 ------- 4.99, 4.99], ..
2020. 2. 21.