可能是Pandas/Python: 2D histogram fails with value error的副本。但那里提出的解决方案对我来说并不管用。在
我尝试在两个数组上使用numpyhistogram2d,每个数组大小为55812。当我运行命令np.histogram2d(x,y)
时,我得到以下错误:
np.histogram2d(np.array(nlx_angle[50000:55000]),np.array(nlx_speed[50000:55000]), bins=(100,100))
File "C:\Anaconda2\lib\site-packages\numpy\lib\twodim_base.py", line 714, in histogram2d
hist, edges = histogramdd([x, y], bins, range, normed, weights)
File "C:\Anaconda2\lib\site-packages\numpy\lib\function_base.py", line 802, in histogramdd
decimal = int(-log10(mindiff)) + 6
ValueError: cannot convert float NaN to integer
我已经从数据中删除了所有的NaN。另外,问题的答案(上面的链接)建议使用数据的子集,但是对于我的应用程序,我需要使用整个数据。我使用的是numpy 1.11.0版
谢谢你的帮助!在
编辑1
我用过np.哪里(nlx_angle==np.nan)
和np.where(nlx_speed==np.nan)
来检查NaN,它返回的结果是(array([], dtype=int64), array([], dtype=int64))
目前没有回答
相关问题 更多 >
编程相关推荐