title: How can I add a 1D array to a segment of a 2D array?
body: <p>I have a 2D NumPy array filled with zeroes (placeholder values). I would like to add a 1D array filled with ones and zeroes to a part of it. eg.</p>
  <ul>
  <li><p>2D array:</p>
  <pre><code>array([[0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0]])
  </code></pre>
  </li>
  <li><p>1D array:</p>
  <pre><code>array([1, 0, 1])
  </code></pre>
  </li>
  </ul>
  <p>Desired end product: I want the array starting in position <code>[2, 1]</code></p>
  <pre><code>array([[0, 0, 0, 0, 0],
         [0, 0, 1, 0, 1],
         [0, 0, 0, 0, 0]]) 
  </code></pre>
  <p>Or an insertion in any other position it could reasonably fit in. I have tried to do it with boolean masks but have not had any luck creating one in the correct shape. I have also tried flattening the 2D array, but couldn't figure out how to replace the values in the correct space.</p>