แค่:
>>> m = np.matrix(np.random.random((5, 5)))
>>> m
matrix([[0.91074101, 0.65999332, 0.69774588, 0.007355 , 0.33025395],
[0.11078742, 0.67463754, 0.43158254, 0.95367876, 0.85926405],
[0.98665185, 0.86431513, 0.12153138, 0.73006437, 0.13404811],
[0.24602225, 0.66139215, 0.08400288, 0.56769924, 0.47974697],
[0.25345299, 0.76385882, 0.11002419, 0.2509888 , 0.06312359]])
>>> m[:,[1, 2]]
matrix([[0.65999332, 0.69774588],
[0.67463754, 0.43158254],
[0.86431513, 0.12153138],
[0.66139215, 0.08400288],
[0.76385882, 0.11002419]])
คอลัมน์ไม่จำเป็นต้องเรียงตามลำดับ:
>>> m[:,[2, 1, 3]]
matrix([[0.69774588, 0.65999332, 0.007355 ],
[0.43158254, 0.67463754, 0.95367876],
[0.12153138, 0.86431513, 0.73006437],
[0.08400288, 0.66139215, 0.56769924],
[0.11002419, 0.76385882, 0.2509888 ]])