title: NumbaNotImplementedError: only one advanced index supported -> how to rewrite a 3D [x,y,x] -> 2D array replacement of values numba can handle
body: <p>I'm converting some odd code over to be Numba compatible using <code>parallel=True</code>.  It has a problematic array assignment that I can't quite figure out how to rewrite in a way numba can handle.  I try to decode what the error means, but I get quite lost.  The only thing clear is it does not like the line: <code>Averaging_price_3D[leg, :, expired_loc] = last_non_expired_values.T</code> The error is pretty long, included for reference here:</p>
  <pre><code>TypingError: No implementation of function Function(&lt;built-in function setitem&gt;) found for signature:
  
  setitem(array(float64, 3d, C), Tuple(int64, slice&lt;a:b&gt;, array(int64, 1d, C)), array(float64, 2d, F))
  
  There are 16 candidate implementations:
    - Of which 14 did not match due to:
    Overload of function 'setitem': File: &lt;numerous&gt;: Line N/A.
      With argument(s): '(array(float64, 3d, C), Tuple(int64, slice&lt;a:b&gt;, array(int64, 1d, C)), array(float64, 2d, F))':
     No match.
    - Of which 2 did not match due to:
    Overload in function 'SetItemBuffer.generic': File: numba\core\typing\arraydecl.py: Line 176.
      With argument(s): '(array(float64, 3d, C), Tuple(int64, slice&lt;a:b&gt;, array(int64, 1d, C)), array(float64, 2d, F))':
     Rejected as the implementation raised a specific error:
       NumbaNotImplementedError: only one advanced index supported
  </code></pre>
  <p>And here is a short code segment to reproduce the error:</p>
  <pre><code>import numpy as np
  import numba as nb
  
  @nb.jit(nopython=True, parallel=True, nogil=True)
  def main(Averaging_price_3D, expired_loc, last_non_expired_values):
  
      for leg in range(Averaging_price_3D.shape[0]):
          # line below causes the numba error:
          Averaging_price_3D[leg, :, expired_loc] = last_non_expired_values.T
      return Averaging_price_3D
  
  if __name__ == &quot;__main__&quot;:
      Averaging_price_3D=np.random.rand(2,8192,11)*100 # shape (2,8192,11) 3D array float64
      expired_loc=np.arange(4,10).astype(np.int64) # shape (6,) 1D array int64
      last_non_expired_values = Averaging_price_3D[1,:,0:expired_loc.shape[0]].copy() # shape (8192,6) 2D array float64
  
      result = main(Averaging_price_3D, expired_loc, last_non_expired_values)
  </code></pre>
  <p>Now the best I can interpret this error is that &quot;numba doesn't know how to set values in a 3D matrix using array indexing with values from a 2D array.&quot;  But I searched online quite a bit and can't find another way to accomplish the same thing, without numba crashing on it.</p>
  <p>In other cases like this I resorted to flattening the arrays with a .reshape(-1) before indexing, but I'm having issues with figuring out how to do that in this specific case (that was easy with a 3D array indexed with another 3D array, as they both would flatten in the same order)...  Any help is appreciated!</p>