RuntimeWarning: invalid value encountered in maximum
问题 Weird behavior (bug??) in numpy. Contrary to the docs, the following code gives a RuntimeWarning: invalid value encountered in fmax a = np.random.uniform(0.1, 0.4, (5, 5)) b = np.random.uniform(0, 3.5, (5, 5)) b[0, 0] = np.nan c = np.fmax(a, b) # Same problem with c = np.maximum(a, b) I'm stuck as I need these NaNs in my arrays and now my functions stop in iPython with this damn warning (ok, they really don't stop but it's rather annoying) EDIT : numpy 1.6.1 ipython 0.13.1 回答1: I get the same