Numpy combines two matrices. TypeError: only length-1 arrays can be converted to Python scans

I perform the following operation:

matrix_a = np.concatenate(matrix_a, matrix_b) 

both types of matrices <type 'numpy.ndarray'>

matrix shapes:

 (26, 127) (67, 127) 

The operation causes the following error:

 TypeError: only length-1 arrays can be converted to Python scalars 

Can someone explain why I am getting this error and how to fix it?

Many thanks!

+5
source share
1 answer

Fixed. Matrices should be a tuple:

 matrix_a = np.concatenate((matrix_a, matrix_b)) 
+10
source

Source: https://habr.com/ru/post/1202322/


All Articles