title: numpy pad a sequence instead of constant values
body: <p>I am trying to pad a numpy array with a sequence <code>[0, 1]</code> along each row. So for example if I have an array as:</p>
  
  <pre><code>x = np.random.rand(2, 4)
  
  array([[0.51352468, 0.4274193 , 0.11244252, 0.56787658],
         [0.37855923, 0.80976327, 0.0290558 , 0.87585656]])
  </code></pre>
  
  <p>After the padding operation, it becomes:</p>
  
  <pre><code>array([[0.51352468, 0.4274193 , 0.11244252, 0.56787658],
         [0.37855923, 0.80976327, 0.0290558 , 0.87585656],
         [0.        , 0.        , 0.        , 0.        ],
         [1.        , 1.        , 1.        , 1.        ]])
  </code></pre>
  
  <p>Currently, the way I am doing this is:</p>
  
  <pre><code>padded = np.asarray(x)
  padded = np.pad(padded, [(0, 4 - len(padded.shape[0])), (0, 0)], 'constant')
  padded[:, -1] = 1.0
  </code></pre>
  
  <p>This seems a bit cumbersome as I pad with zeros and then set the last row to 1. I was wondering if there is a way to do this with just one <code>numpy.pad</code> call?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>As you can see from the code above, the function will convert the input to a 4 dimensional object (the input dimension of the array is either 2 or 3 i.e. len(x) == 2 or 3). So, if the input is 2 dimensional, it will add two rows of zeros and then set the last one to 1. if the input is 3 dimensional, it will add a row of zeros and then overwrite to a row of ones.</p>