title: Zero Padding a 3d Numpy array
body: <p>I have a 3d numpy array(data) with shape say (103, 37, 13). I want to resize this numpy array to (250,250,13) by zero padding almost equally in both directions along each axis.</p>
  
  <p>The code below works well for 2d array, but I am not able to make it work for 3d array.</p>
  
  <pre><code>&gt;&gt;&gt; a = np.arange(6)
  &gt;&gt;&gt; a = a.reshape((2, 3))
  &gt;&gt;&gt; np.lib.pad(a, [(2,3),(1,1)], 'constant', constant_values=[(0, 0),(0,0)])
  array([[0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0],
         [0, 0, 1, 2, 0],
         [0, 3, 4, 5, 0],
         [0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0]])
  
  &gt;&gt;&gt; zerpads =np.zeros(13)
  &gt;&gt;&gt; data1=np.lib.pad(data,[(73,74),(106,107)],'constant',constant_values=[(zerpads, zerpads),(zerpads,zerpads)])
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/home/ayush/anaconda2/lib/python2.7/site-packages/numpy/lib/arraypad.py", line 1295, in pad
      pad_width = _validate_lengths(narray, pad_width)
    File "/home/ayush/anaconda2/lib/python2.7/site-packages/numpy/lib/arraypad.py", line 1080, in _validate_lengths
      normshp = _normalize_shape(narray, number_elements)
    File "/home/ayush/anaconda2/lib/python2.7/site-packages/numpy/lib/arraypad.py", line 1039, in _normalize_shape
      raise ValueError(fmt % (shape,))
  ValueError: Unable to create correctly shaped tuple from [(73, 74), (106, 107)]
  </code></pre>