Numpy array dimensions

前端 未结 8 542
谎友^
谎友^ 2020-11-30 17:13

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 funct

8条回答
  •  野性不改
    2020-11-30 17:29

    It is .shape:

    ndarray.shape
    Tuple of array dimensions.

    Thus:

    >>> a.shape
    (2, 2)
    

提交回复
热议问题