Farseer
Farseer

Reputation: 4172

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

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!

Upvotes: 6

Views: 4295

Answers (1)

Farseer
Farseer

Reputation: 4172

Fixed. Matrices should be a tuple:

matrix_a = np.concatenate((matrix_a, matrix_b))

Upvotes: 14

Related Questions