Why does the program
import numpy as np c = np.array([1,2]) print(c.shape) d = np.array([[1],[2]]).transpose() print(d.shape)
give
<
transpose does not change the number of dimensions of the array. If c.ndim == 1, c.transpose() == c. Try:
transpose
c.ndim == 1
c.transpose() == c
c = np.array([1,2]) print c.shape print c.T.shape c = np.atleast_2d(c) print c.shape print c.T.shape