Note
Numpy (17) 본문
728x90
How to swap two rows in a 2d numpy array?
# Input
arr = np.arange(9).reshape(3,3)
# Solution
arr[[1,0,2], :]
# output
array([[3, 4, 5],
[0, 1, 2],
[6, 7, 8]])
'Numpy' 카테고리의 다른 글
Numpy (19) (0) | 2022.08.10 |
---|---|
Numpy (18) (0) | 2022.08.09 |
Numpy (16) (0) | 2022.08.07 |
Numpy (15) (0) | 2022.08.06 |
Numpy (14) (0) | 2022.08.05 |
Comments