import numpy as np matrix = np.array( [ [1, 2, 3], [4, 5, 6], ] ) columns = matrix.T cube = np.arange(24).reshape(2, 3, 4) swapped = np.transpose(cube, axes=(1, 0, 2)) vector = np.array([1, 2, 3]) column_vector = vector[:, np.newaxis] print("matrix shape:", matrix.shape) print("matrix.T shape:", columns.shape) print(columns) print("cube shape:", cube.shape) print("swapped shape:", swapped.shape) print("axis value check:", cube[1, 2, 3] == swapped[2, 1, 3]) print("transpose shares memory:", np.shares_memory(matrix, columns)) print("vector.T shape:", vector.T.shape) print("column vector shape:", column_vector.shape)