[Python] How to raise an array of numbers to a power with NumPy?

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

  1. Stack

    Stack Membro Participativo

    NumPy has log, log2, and log10 methods which can perform vectorized log base e / 2 / 10 (respectively). However, for doing the inverse operation (exponentiation), I only see exp. Why is there no exp2 / exp10 / etc?

    I've tried using np.power(10, nums), but it won't let me raise to a negative power. 10 ** nums does not work either.

    Continue reading...

Compartilhe esta Página