cliffgao的个人博客分享 http://blog.sciencenet.cn/u/cliffgao 兴趣:生物信息学、统计、概率

博文

报错runtimgWarning invalid value encountered in true_divide

已有 368 次阅读 2019-4-9 09:25 |个人分类:python|系统分类:科研笔记

遇到问题


/sw/python/2.7.6/lib/python2.7/site-packages/scipy-0.14.0-py2.7-linux-x86_64.egg/scipy/stats/stats.py:2714: RuntimeWarning: invalid value encountered in true_divide

  t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs)))

/sw/python/2.7.6/lib/python2.7/site-packages/scipy-0.14.0-py2.7-linux-x86_64.egg/scipy/stats/_distn_infrastructure.py:1718: RuntimeWarning: invalid value encountered in greater

  cond1 = (scale > 0) & (x > self.a) & (x < self.b)

/sw/python/2.7.6/lib/python2.7/site-packages/scipy-0.14.0-py2.7-linux-x86_64.egg/scipy/stats/_distn_infrastructure.py:1718: RuntimeWarning: invalid value encountered in less

  cond1 = (scale > 0) & (x > self.a) & (x < self.b)

/sw/python/2.7.6/lib/python2.7/site-packages/scipy-0.14.0-py2.7-linux-x86_64.egg/scipy/stats/_distn_infrastructure.py:1719: RuntimeWarning: invalid value encountered in less_equal

  cond2 = cond0 & (x <= self.a)


解决方法: 

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



参考:https://stackoverflow.com/questions/14861891/runtimewarning-invalid-value-encountered-in-divide



http://blog.sciencenet.cn/blog-468005-1172244.html

上一篇:制作R软件包 全局变量问题
下一篇:numpy 中的 nan

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备14006957 )

GMT+8, 2019-5-23 17:39

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部