擅长:python、mysql、java
<p>您的<code>array</code>中没有足够的元素,例如:</p>
<pre><code>In [5]: import numpy as np
In [6]: a = np.array([1,2])
In [8]: a[2] # there is no element at 2nd index
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-8-016a87a854bc> in <module>()
----> 1 a[2]
IndexError: index 2 is out of bounds for axis 0 with size 2
</code></pre>