我在jupyter笔记本中运行第41个脚本,该脚本显示:
TypeError
Traceback (most recent call last)
<ipython-input-4-a8519e2b712a> in <module>
24
25 for i, mi in enumerate(markers):
---> 26 plt.plot(x[i], y[i], "b", alpha=0.5, marker=getRandomMarker(), markersize=randint(16,26,1))
27 plt.plot(x[i], y[i]+50, "m", alpha=0.5, marker=getMarker(i), markersize=randint(16,26,1))
28 # Let's see if their "center" is located where we expect them to be...
<ipython-input-4-a8519e2b712a> in getRandomMarker()
17
18 def getRandomMarker():
---> 19 return "$"+markers[randint(0,len(markers),1)]+"$"
20
21 def getMarker(i):
TypeError: only integer scalar arrays can be converted to a scalar index
但是,此脚本在空闲状态下可以很好地工作,为什么Notebook有此类错误?