numpy array 변환 시 Error

전민수·2023년 9월 7일
1

발생 Error

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (181, 2) + inhomogeneous part.

-> 불균일한 데이터 형식으로 인한 Error

해결 : numpy array로 변환시 데이터 타입을 object로 설정

list = [[1,2], [[3,4,5], [6,7,8]]]
# shape 불균일함

array = np.array(list)
# error

array = np.array(list, dtype=object)
# solution
profile
Learning Mate

0개의 댓글