title: Replace values in array using mask of different dimension
body: <p>I read <a href="https://stackoverflow.com/questions/52123272/replace-values-in-array-using-mask-and-other-array">this answer</a> and wondered if this can be used to replace nested arrays.</p>
  <p>So I tried:</p>
  <pre><code>import numpy as np
  
  frm = [[[1,2], [2,3]], [[3,4], [4,5]], [[5,6], [6,7]]]
  mask = [[False, True], [False, True], [True, False]]
  repl = [0,0]
  # convert frm to a numpy array:
  frm = np.array(frm)
  # create a copy of frm so you don't modify original array:
  to = frm.copy()
  
  # mask to, and insert your replacement values:
  to[mask] = repl
  
  print(to)
  </code></pre>
  <p>However I get the error <code>IndexError: boolean index did not match indexed array along dimension 0; dimension is 3 but corresponding boolean dimension is 2</code></p>
  <p>My goal here is to replace a nested array with another array. E.g. I want this value <code>[2,3]</code> in the first column to be replaced by this <code>[0,0]</code></p>