axis 1 is out of bounds for array of dimension 1

boingboing·2023년 8월 10일
0
import numpy as np

# Creating a one-dimensional array
arr = np.array([1, 2, 3, 4, 5])

# Trying to perform an operation along axis 1
result = np.sum(arr, axis=1)  # This will result in the error
  • 배열에 없는 axis로 연산하려고 할 때 발생
  • 1차원이라 인덱싱이 axis0밖에 안되는데 1로 함 ㅇㅅㅇ바부

1개의 댓글

comment-user-thumbnail
2023년 8월 10일

좋은 정보 감사합니다

답글 달기