Numpy array dimensions
Asked 07 September, 2021
Viewed 412 times
  • 65
Votes

I'm currently trying to learn Numpy and Python. Given the following array:

import numpy as np
a = np.array([[1,2],[1,2]])

Is there a function that returns the dimensions of a (e.g.a is a 2 by 2 array)?

size() returns 4 and that doesn't help very much.

8 Answer