我试图在Python中为一个项目分散一些数据,但我有一些我想要排除的错误值。我的所有数据都是包含数字的数组,它们是:P0_d, P0_m, P0_b ; al_d, al_m, al_b
代码是:
ii = (al_m>-400) & (al_b>-400)
scat1 = scatter(P0_d, al_d, color ='blue', s=200)
scat2 = scatter(P0_m[ii], al_m[ii], color='green', marker='^', s=200, alpha=0.8)
scat3 = scatter(P0_b[ii], al_b[ii], color='red', marker='s', s=200, alpha=0.6)
显示的错误是:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-467-2d64e43bad52> in <module>()
5 scat1 = scatter(P0_d, al_d, color ='blue', s=200)
6 scat2 = scatter(P0_m[ii], al_m[ii], color='green', marker='^', s=200, alpha=0.8)
----> 7 scat3 = scatter(P0_b[ii], al_b[ii], color='red', marker='s', s=200, alpha=0.6)
TypeError: only integer arrays with one element can be converted to an index
我看了几个答案,但没有找到任何有效的方法。我不是很精通技术,所以对任何帮助表示赞赏!
答案 0 :(得分:0)
这似乎不完整。例如,什么是P0_b?