In [1]:
import numpy as np

In [11]:
# 1-d array
a1 = np.array([1,2,3])
a1,a1.shape


Out[11]:
(array([1, 2, 3]), (3,))

In [13]:
# 1x3 matrix
a2 = np.array([1,2,3]).reshape(1,-1)
a2,a2.shape


Out[13]:
array([[1, 2, 3]])

In [14]:
# 3x1 matrix
a3 = np.array([1,2,3]).reshape(-1,1)
a3,a3.shape


Out[14]:
(array([[1],
        [2],
        [3]]), (3, 1))

In [9]:
np.array([1,2,3]).reshape(1).shape


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-1e5c8fdd3fca> in <module>()
----> 1 np.array([1,2,3]).reshape(1).shape

ValueError: total size of new array must be unchanged