Question

I have an array:

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

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

Était-ce utile?

La solution

There is:

from numpy import inf
x[x == -inf] = 0
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top