title: Best way to create a NumPy array from a dictionary?
body: <p>I'm just starting with NumPy so I may be missing some core concepts...</p>
  
  <p>What's the best way to create a NumPy array from a dictionary whose values are lists?</p>
  
  <p>Something like this:</p>
  
  <pre><code>d = { 1: [10,20,30] , 2: [50,60], 3: [100,200,300,400,500] }
  </code></pre>
  
  <p>Should turn into something like:</p>
  
  <pre><code>data = [
    [10,20,30,?,?],
    [50,60,?,?,?],
    [100,200,300,400,500]
  ]
  </code></pre>
  
  <p>I'm going to do some basic statistics on each row, eg:</p>
  
  <pre><code>deviations = numpy.std(data, axis=1)
  </code></pre>
  
  <p>Questions:</p>
  
  <ul>
  <li><p>What's the best / most efficient way to create the numpy.array from the dictionary? The dictionary is large; a couple of million keys, each with ~20 items.</p></li>
  <li><p>The number of values for each 'row' are different. If I understand correctly numpy wants uniform size, so what do I fill in for the missing items to make std() happy?</p></li>
  </ul>
  
  <p>Update: One thing I forgot to mention - while the python techniques are reasonable (eg. looping over a few million items is fast), it's constrained to a single CPU. Numpy operations scale nicely to the hardware and hit all the CPUs, so they're attractive.</p>