Search code examples
arrayspython-2.7numpydimensions

Python array dimensions


I'm currently learning numpy and I find 'Array Dimensions' . Can anyone explain to me what are array dimensions ? How to find out the dimensions of an array ? Thank you ,


Solution

  • You can print a tuple of the dimensions of an array like so:

    print array.shape
    

    Let's say it was (2,3). Your array might be: [[1,2,3],[3,2,1]] So basically the first dimension is the number of elements in the outer part, then the second is the number of elements in an inner part, and so on...