【发布时间】:2013-02-18 00:20:57
【问题描述】:
numpy 中的奇怪行为(错误??)与文档相反,以下代码给出了 RuntimeWarning: invalid value遇到的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)
我被困住了,因为我需要在我的数组中使用这些 NaN,现在我的函数在 iPython 中停止了这个该死的警告(好吧,它们真的没有停止,但它很烦人)
编辑:
numpy 1.6.1
ipython 0.13.1
【问题讨论】:
-
什么版本?我刚试了你的代码,没有收到警告
-
哦,我正在运行 1.6.2
-
此安装是在 Win7 机器上的 EPD 安装。 numpy 1.6.1-3,ipython 0.13.1-2。对于带有 numpy 1.7.0 和 ipython 0.13.1 的盒子,我也没有更多警告......也许 1.6.1 有问题 ..
标签: python numpy runtime-error max nan