반응형
Notice
Recent Posts
Recent Comments
Link
목록numpy (1)
It's easy, if you try
[파이썬] numpy array 정렬
1차원배열 정렬 좌에서 우로 정렬: np.sort(x) 거꾸로 정렬: np.sort(x)[::-1] , x[np.argsort(-x)] 2차원배열 정렬 열 축 기준(좌에서 우로)으로 정렬 : np.sort(x, axis=1) 행 축 기준(위에서 아래로)으로 정렬: np.sort(x, axis=0) 행 축 기준(위에서 아래로)으로 거꾸로 정렬: np.sort(x, axis=0)[::-1] 예시 np.sort(x) x = np.array([3,5,1]) --- 정렬 후 ---> array([1,3,5]) np.sort(x)[::-1] , x[np.argsort(-x)] x = np.array([3,5,1]) --- 정렬 후 ---> array([5,3,1]) np.sort(x, axis=1) x = np.a..
언어/파이썬(Python)
2021. 2. 16. 21:30