title: Convert 1D array into numpy matrix
body: <p>I have a simple, one dimensional Python array with random numbers. What I want to do is convert it into a numpy Matrix of a specific shape. My current attempt looks like this:</p>
  
  <pre><code>randomWeights = []
  for i in range(80):
      randomWeights.append(random.uniform(-1, 1))
  W = np.mat(randomWeights)
  W.reshape(8,10)
  </code></pre>
  
  <p>Unfortunately it always creates a matrix of the form:</p>
  
  <p>[[random1, random2, random3, ...]]</p>
  
  <p>So only the first element of one dimension gets used and the reshape command has no effect. Is there a way to convert the 1D array to a matrix so that the first x items will be row 1 of the matrix, the next x items will be row 2 and so on?</p>
  
  <p>Basically this would be the intended shape:</p>
  
  <pre><code>[[1, 2, 3, 4, 5, 6, 7, 8],
   [9, 10, 11, ... ,    16],
   [...,               800]]
  </code></pre>
  
  <p>I suppose I can always build a new matrix in the desired form manually by parsing through the input array. But I'd like to know if there is a simpler, more eleganz solution with built-in functions I'm not seeing. If I have to build those matrices manually I'll have a ton of extra work in other areas of the code since all my source data comes in simple 1D arrays but will be computed as matrices.</p>