title: Insert Rows and columns in Numpy
body: <p>I have the following code </p>
  
  <pre><code>row, col = image.shape
  print image
  for x in range(row):
    for y in range(col):
      image = np.insert(image, [x,y], values=0, axis=1)
  print image
  </code></pre>
  
  <p>I get this error when I run my code, </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\...\Code.py", line 55, in &lt;module&gt;
      expand(img1)
    File "C:\...\Code.py", line 36, in expand
      image = np.insert(image, [x,y], values=0, axis=1)
    File "C:\Python27\lib\site-packages\numpy\lib\function_base.py", line 3627, in insert
      new[slobj2] = arr
  ValueError: array is not broadcastable to correct shape
  </code></pre>
  
  <p>What I would like the function to do is given an array of size i,j it inserts a row and column of zero's between each row and column. </p>
  
  <p>so if I have </p>
  
  <pre><code>`array([[1,2,3], 
          [4,5,6],
          [7,8,9]])`
  </code></pre>
  
  <p>the function would return a result of </p>
  
  <pre><code>[1,0,2,0,3,0]
  [0,0,0,0,0,0]
  [4,0,5,0,6,0]
  [0,0,0,0,0,0]
  [7,0,8,0,9,0]
  [0,0,0,0,0,0]
  </code></pre>
  
  <p>I have also tried, </p>
  
  <pre><code>row, col = image.shape
  for x in range(row):
    image = np.insert(image, x, values=0, axis=1)
  for y in range(col):
    image = np.insert(image, y, values=0, axis=1)
  </code></pre>
  
  <p>But I do not get the result I am looking for. </p>