Replace -inf with zero value March 12, 2023 by Tarik There is: from numpy import inf x[x == -inf] = 0