How can I avoid getting warning message when I execute the following code?
from numpy import inf
a = np.array([0.2,0.2,0.3])
b = np.array([0.3,0.0,0.1])
a = np.log10(a)
b = np.log10(b)
b[b == -inf] = 0
a[a == -inf] = 0
calc = a+b
The warning message received:
divide by zero encountered in log10
The code should yield the following result:
array([-1.22184875, -0.69897 , -1.52287875])