RuntimeWarning: invalid value encountered in divide

The Solution to RuntimeWarning: invalid value encountered in divide is


I think your code is trying to "divide by zero" or "divide by NaN". If you are aware of that and don't want it to bother you, then you can try:

import numpy as np
np.seterr(divide='ignore', invalid='ignore')

For more details see:

~ Answered on 2014-04-16 18:05:59


Most Viewed Questions: