Code
numpy
import numpy as np
a = np.arange(12)
# Reshape and -1 inference
b = a.reshape(3, 4)
c = a.reshape(-1, 2) # 6 rows inferred
flat = b.flatten() # copy
ravel = b.ravel() # view when possible
# Transpose and swap axes
t = b.T
swapped = b.swapaxes(0, 1)
# Stacking
x = np.array([1, 2, 3])
y = np.array([4, 5, 6])
vstack = np.vstack([x, y]) # rows
hstack = np.hstack([x, y]) # columns
concat = np.concatenate([x, y])
print(b.shape, c.shape, vstack.shape)