Numpy Array Error With dtype = numpy.uint8

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 I run the code below, I get the message "setting an array element with a sequence". The question is: how to make an INT array 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)
    
asked by anonymous 10.05.2018 / 15:29

1 answer

0

works if vectors have the same number of elements

M = numpy.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]], dtype=numpy.uint8)
    
11.05.2018 / 19:43