Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

numpy concatenate two matrices . TypeError: only length-1 arrays can be converted to Python scalars

Tags:

numpy

I performing following operation:

matrix_a = np.concatenate(matrix_a, matrix_b)

both matrices type is <type 'numpy.ndarray'>

shapes of matrices are:

(26, 127)
(67, 127)

The operation throws following error:

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

Can someone explain why i get this error and how to fix that?

Many thanks!

like image 261
Farseer Avatar asked Sep 11 '14 08:09

Farseer


1 Answers

Fixed. Matrices should be a tuple:

matrix_a = np.concatenate((matrix_a, matrix_b))
like image 100
Farseer Avatar answered Jan 02 '23 20:01

Farseer