# import numpy with the socially accepted alias 'np'
>>> import numpy as np
# the array
>>> A = np.arange(6)
>>> A
array([0, 1, 2, 3, 4, 5])
# reshape the array into a 2x3 array
>>> A = A.reshape(2, 3)
>>> A
array([[0, 1, 2],
[3, 4, 5]])
# transpose the array
>>> A.T
array([[0, 3],
[1, 4],
[2, 5]])
# get back to a 'flat' array with shape (6,)
>>> A.ravel()
array([0, 1, 2, 3, 4, 5])
# reshape the array into a 3x2 array
>>> A.reshape(3, 2)
array([[0, 1],
[2, 3],
[4, 5]])
# join two arrays --- note the dimensions for the concatenation must match
>>> np.concatenate((A.reshape(3, 2), A.T))
array([[0, 1],
[2, 3],
[4, 5],
[0, 3],
[1, 4],
[2, 5]])
# stack two arrays vertically (ROW-WISE)
>>> np.vstack((A, np.array([6, 7, 8])))
# stack two arrays horizontally (COLUMN-WISE)
>>> np.hstack((A, np.array([6, 7]).reshape(2, 1)))
array([[0, 1, 2, 6],
[3, 4, 5, 7]])