[Numpy-discussion] three-dim array

Jeff jeffp at vodafonemail.de
Tue Dec 25 21:10:07 EST 2018


hello,

sorry newbe to numpy.

I want to define a three-dim array.
I know this works:

 >>> np.array([[[1,2],[3,4]],[[5,6],[7,8]]])
array([[[1, 2],
         [3, 4]],

        [[5, 6],
         [7, 8]]])

But can you tell why this doesnt work?

 >>> np.array([[1,2],[[1,2],[3,4]]])
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ValueError: setting an array element with a sequence.


Thank you.


More information about the NumPy-Discussion mailing list