728x90
In [2]:
import numpy as np
In [4]:
test_example = np.array([[1, 2, 3], [4.5, 5, 6]], int)
test_example
Out[4]:
In [6]:
test_example[0][0]
Out[6]:
numpy에서는 [row, col]과 같이 지정해주어도 된다는 것을 확인할 수 있다.
In [8]:
test_example[0, 0]
Out[8]:
In [10]:
test_example[0, 0] = 10
test_example
Out[10]:
In [12]:
test_example[0][0] = 5
test_example[0, 0]
Out[12]:
In [14]:
test_example = np.array([[1,2,5,8], [1,2,5,8], [1,2,5,8], [1,2,5,8]], int)
test_example[:2, :]
Out[14]:
In [19]:
print(test_example[:, 1:3])
print(test_example[1, :2])
Out [19]:
In [21]:
test_example = np.array([[1,2,3,4,5], [6,7,8,9,10]], int)
test_example[:, 2:]
Out[21]:
In [23]:
test_example[1, 1:3]
Out[23]:
In [25]:
test_example[1:3]
Out[25]:
In [27]:
a = np.arange(100).reshape(10, 10)
a[:, -1].reshape(-1, 1)
Out[27]:
728x90
'Numpy' 카테고리의 다른 글
[Numpy] Operation, Dot product, Broadcasting (0) | 2021.07.16 |
---|---|
[Numpy] Operation_function, Concatenate (0) | 2021.07.16 |
[Numpy] Arange, ones, zeros, empty, eye, identity, digonal, random (0) | 2021.07.16 |
[Numpy] Reshape (0) | 2021.07.16 |
[Numpy] Array 생성 (0) | 2021.07.16 |