title: numpy array - use np.concatenate or np.insert to prepend and append rows of zeros to ndarray
body: <p>I am fairly new to numpy and I very well may be asking a stupid question, so I apologize in advance if this not a good question or if the question needs more clarifications.</p>
  
  <p><strong>The task</strong></p>
  
  <p>For example, I have an image represented as an ndarray of size (10,20,3) and I am trying to change the size of the array to (12,20,3) by inserting 1px at the beginning and at the end of the image. Essentially, I am trying to achieve image resize with padding only on the top and bottom of the image.</p>
  
  <p>This is basically what I am trying to achieve, represented with arrays of smaller dimensions.</p>
  
  <p><strong>Original array</strong></p>
  
  <pre><code>[ [[255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]]
  
   [[255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]]]
  </code></pre>
  
  <p><strong>Modified array</strong></p>
  
  <pre><code>[[[  0.   0.   0.]
    [  0.   0.   0.]
    [  0.   0.   0.]
    [  0.   0.   0.]]
  
   [[255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]]
  
   [[255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]]
  
   [[  0.   0.   0.]
    [  0.   0.   0.]
    [  0.   0.   0.]
    [  0.   0.   0.]]]
  </code></pre>
  
  <p>My plan is to use numpy.concatenate using the following steps.</p>
  
  <p>#1 Create an array of 0's with this dimension (1,4,3)</p>
  
  <p>#2 Concatenate the original array to the array from step 1. This will create a new array like this</p>
  
  <pre><code>[[[  0.   0.   0.]
    [  0.   0.   0.]
    [  0.   0.   0.]
    [  0.   0.   0.]]
  
   [[255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]]
  
   [[255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]
    [255. 255. 255.]]]
  </code></pre>
  
  <p>#3 Use the array from step 1 and append it to the array that was created in part 2 and this will finally give me the result I want.</p>
  
  <p>However, I also wonder if there is a way to use numpy.insert and just insert (1,4,3) to the beginning and end of the array without complicating this with concatenate. I would appreciate any input on this.</p>