How do I get the dimensions of an array? For instance, this is 2x2:
a = np.array([[1, 2], [3, 4]])
Use .shape to obtain a tuple of array dimensions:
.shape
>>> a.shape (2, 2)