Ignore divide by 0 warning in NumPy
问题 I have a function for statistic issues: import numpy as np from scipy.special import gamma as Gamma def Foo(xdata): ... return x1 * ( ( #R is a numpy vector ( ((R - x2)/beta) ** (x3 -1) ) * ( np.exp( - ((R - x2) / x4) ) ) / ( x4 * Gamma(x3)) ).real ) Sometimes I get from the shell the following warning: RuntimeWarning: divide by zero encountered in... I use the numpy isinf function to correct the results of the function in other files, so I do not need this warning. Is there a way to ignore