[Python_Error] TypeError: unsupported operand type(s) for -: 'int' and 'list'
본 포스팅은 업무 중 발생했던 오류들을 예시를 통해 어떻게 해결을 했는지 적을 예정이다. TypeError: unsupported operand type(s) for -: 'int' and 'list' 본 오류는 array 내에 scalar 값이 아닌 list가 들어가서 발생한 오류이다. [예시] import numpy as np rand_cube_3D = np.random.randint(0,100,size=[3,3,3]) print(rand_cube_3D) """ array([[[87, 58, 63], [ 3, 44, 32], [81, 11, 80]], [[20, 84, 77], [56, 8, 32], [38, 99, 61]], [[71, 83, 58], [85, 29, 65], [67, 33, 70]..
2022. 9. 29.
[Python_Error] TypeError: only integer scalar arrays can be converted to a scalar index
본 포스팅은 업무 중 발생했던 오류들을 예시를 통해 어떻게 해결을 했는지 적을 예정이다. TypeError: only integer scalar arrays can be converted to a scalar index list index에 scalar 가 아닌 np.array가 들어갔을 때 발생하는 오류이다. [예시] import numpy as np rand_cube_3D = np.random.randint(0,10,size=[5,5,5]) print(rand_cube_3D) """ array([[[3, 1, 4, 8, 9], [7, 1, 2, 8, 3], [4, 9, 0, 6, 9], [8, 9, 9, 4, 0], [5, 0, 5, 8, 1]], [[9, 4, 2, 9, 2], [6, 7, 6, 8..
2022. 9. 29.