>>> import numpy as np >>> M = np.array([[1,2,3],[4,5,6],[7,8,9]]) >>> M array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> M.T array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])