Numpy array dimensions

前端 未结 8 528
谎友^
谎友^ 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条回答
  •  -上瘾入骨i
    2020-11-30 17:30

    a.shape is just a limited version of np.info(). Check this out:

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

    Out

    class:  ndarray
    shape:  (2, 2)
    strides:  (8, 4)
    itemsize:  4
    aligned:  True
    contiguous:  True
    fortran:  False
    data pointer: 0x27509cf0560
    byteorder:  little
    byteswap:  False
    type: int32
    

提交回复
热议问题