Pregunta

I have an array:

x =  numpy.array([-inf, -inf, 37.49668579])

Is there a way to change the -inf values to just 0?

¿Fue útil?

Solución

There is:

from numpy import inf
x[x == -inf] = 0
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top