[Python] How can I get the value stored in a 0-dimensional Numpy array?

Discussão em 'Python' iniciado por Stack, Março 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have a numpy array like this

    a = np.array(1)


    How can I get the 1 value back from this array?

    a[0] does not work: it results in IndexError: 0-d arrays can't be indexed.

    Similarly, a(0) gives an error that says TypeError: 'numpy.ndarray' object is not callable.

    Continue reading...

Compartilhe esta Página