import numpy as np a = np.arange(16).reshape(4,4) b = a[1][2] c= a[1, 2] d = a[1:2, 2:3] x = np.array([0, 1, 2, 1]) print(a[x == 1])