Maison  >  Questions et réponses  >  le corps du texte

python - 怎么理解numpy的axis?

1.假如我有一个二维数组:

[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]

那么这里的轴axis怎么理解。axis在上面的数组中最大是多少。我没有看懂英文的教程,请详细解释一下。谢谢。

ringa_leeringa_lee2720 Il y a quelques jours398

répondre à tous(3)je répondrai

  • ringa_lee

    ringa_lee2017-04-18 09:33:08

    Est-ce un tableau à 2 dimensions...
    L'axe doit être 0 ou 1

    répondre
    0
  • 阿神

    阿神2017-04-18 09:33:08

    Vous êtes bidimensionnel
    Apprenez l'algèbre linéaire

    répondre
    0
  • PHP中文网

    PHP中文网2017-04-18 09:33:08

    axe signifie axe, axe numérique
    correspond à la dimension dans le tableau multidimensionnel.
    Votre exemple est un tableau bidimensionnel 4 x 3 avec 2 axes : axe 0 et axe 1


    >>> import numpy as np
    >>> a = np.array([[0,1,2],[3,4,5],[6,7,8],[9,10,11]])
    >>> a
    array([[ 0,  1,  2],
           [ 3,  4,  5],
           [ 6,  7,  8],
           [ 9, 10, 11]])
    >>> a.shape
    (4, 3)
    >>> a.ndim
    2
    >>> 

    répondre
    0
  • Annulerrépondre