Numpy Array Error With dtype=numpy.uint8

Asked

Viewed 143 times

1

The code below works normally, however the elements are "objects".

M = numpy.array([[1,2,3],[1,2],[1,2,3,4]],dtype=object)

However, when executing the code below, I receive the message "Setting an array element with a Sequence". The question is: how to make an array of INT that has this characteristic "[1,2,3],[1,2],[1,2,3,4]"?

M = numpy.array([[1,2,3],[1,2],[1,2,3,4]],dtype=numpy.uint8)

1 answer

0

works if the vectors have the same number of elements

M = numpy.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]], dtype=numpy.uint8)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.