📌 오류가 발생한 코드
import numpy as np
A=np.array([[2,3,4],
[4,8,2],
[1,2,1]])
print("A: "+A[1,]) #여기서 문제 발생
📌 에러명
numpy.core._exceptions.UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U3'), dtype('int32')) -> None
즉, array와 str을 동시에 사용할 수 없다는 것!
🔎 최종적인 결정
: 각각 나누어서 작성하였다!
print("A에서 2행 구하기")
print(A[1,])
📌 참고 주소
'프로그래밍 - 활용 > 에러' 카테고리의 다른 글
[Unity/2D] 씬 전환 불가능 (0) | 2022.02.28 |
---|---|
[Ubuntu] ctrl+D 작동되지 않음 (0) | 2021.12.05 |
[Python] 출력시 int와 str을 함께 사용할 때 발생 (0) | 2021.09.06 |
[Visual Studio & SourceTree] 깃 허브 한글깨짐 해결 (0) | 2021.09.01 |