擅长:python、mysql、java
<p>高级索引的工作原理如下:</p>
<pre><code>A[I, J, K][n] == A[I[n], J[n], K[n]]
</code></pre>
<p>使用<code>A</code>、<code>I</code>、<code>J</code>和<code>K</code>所有数组。这不是完整的,一般的规则,但它的规则简化为什么你需要</p>
<p>例如,如果您想要<code>output[0] == A[0, 0, 0]</code>和<code>output[1] == A[1, 1, 1]</code>,那么您的<code>I</code>、<code>J</code>和<code>K</code>数组应该看起来像<code>np.array([0, 1])</code>。列表也起作用:</p>
<pre><code>A[[0, 1], [0, 1], [0, 1]]
</code></pre>