-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumpy_12.py
More file actions
63 lines (28 loc) · 994 Bytes
/
Copy pathnumpy_12.py
File metadata and controls
63 lines (28 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
import numpy as np
numpy_array_1 = np.array([1, 2, 3])
numpy_array_2 = np.array([4, 5, 6])
# numpy 배열을 왼쪽에서 오른쪽으로 결합
r = np.r_[numpy_array_1, numpy_array_2]
print(r)
# numpy 배열을 왼쪽에서 오른쪽으로 결합
r = np.hstack([numpy_array_1, numpy_array_2])
print(r)
array_1_reshape = numpy_array_1.reshape(-1,1)
array_2_reshape = numpy_array_2.reshape(-1,1)
r = np.r_[array_1_reshape, array_2_reshape]
print(r)
# 2개의 1차원 numpy 배열을
# 세로로 결합하여 2차원 배열 생성
# (각 열의 결합하여 2차원 배열을 생성)
r = np.c_[numpy_array_1, numpy_array_2]
print(r)
# numpy 배열을 왼쪽에서 오른쪽으로 결합
# 세로로 결합하여 2차원 배열 생성
r = np.column_stack([numpy_array_1, numpy_array_2])
print(r)
r = np.c_[array_1_reshape, array_2_reshape]
print(r)
# numpy 배열의 전치 연산의 결과를 반환하는 T 연산자
r = r.T
print(r)