파이썬 numpy 배열에 요소 삽입
목록에는 요소를 삽입하는 매우 간단한 방법이 있습니다. a = [1,2,3,4] a.insert(2,66) print a [1, 2, 66, 3, 4] numpy 배열의 경우 다음을 수행 할 수 있습니다. a = np.asarray([1,2,3,4]) a_l = a.tolist() a_l.insert(2,66) a = np.asarray(a_l) print a [1 2 66 3 4] 그러나 이것은 매우 복잡합니다. numpy 배열에 해당하는 insert 가 있습니까? 해결 방법 >>> import numpy as np >>> a = np.asarray([1,2,3,4]) >>> np.insert(a, 2, 66) array([ 1, 2, 66, 3, 4]) 참조 페이지 https://stackoverfl..
2020. 12. 23.