[Python] numpy array reshape returns a new array, rather than reshaping in place. Any design...

Discussão em 'Python' iniciado por Stack, Abril 25, 2025.

  1. Stack

    Stack Membro Participativo

    a = np.zeros(3)
    print a.reshape((3,1))
    print a


    [[ 0.] [ 0.] [ 0.]]

    [ 0. 0. 0.]
    ​

    It is a bit counter-intuitive that a.reshape does not change the shape of a. Is there any design reason for this?

    Thank you very much.

    Continue reading...

Compartilhe esta Página