0

I want to pass a 2D numpy array z into the function:

np.log(np.abs(z))

I expect z to have a few values that are zero. Is there a way I can override this warning:

RuntimeWarning: divide by zero encountered in log

I know I can just do

np.log(np.abs(z) + 1)

or something similar, but what are my options?

0 Answers0