0

For example, a matrix X

>>> X
array([[ 0,  1,  2,  3,  4],
       [ 5, -1,  7,  8,  9]])

what is the meaning of >>> X[None,:]

array([[[ 0,  1,  2,  3,  4],
        [ 5, -1,  7,  8,  9]]])

So, it changes the dimension of the matrix respect to the None axis? Am I right? Thanks for any help.

3
  • That's not a list. That's a NumPy array. Commented Aug 15, 2017 at 20:53
  • sorry for my mistake. It is a numpy array. Commented Aug 15, 2017 at 20:54
  • It adds a dimension. X is 2d (2,5); X[None, :, :] is 3d (1,2,5). Commented Aug 16, 2017 at 1:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.