title: Python: Conversion from dictionary to array
body: <p>I have a Python dictionary (say <strong>D</strong>) where every key corresponds to some predefined list. I want to create an array with two columns where the <strong>first column corresponds to the keys</strong> of the dictionary D and the <strong>second column corresponds to the sum of the elements in the corresponding lists</strong>. As an example, if, </p>
  
  <pre><code>D = {1: [5,55], 2: [25,512], 3: [2, 18]}
  </code></pre>
  
  <p>Then, the array that I wish to create should be,</p>
  
  <pre><code>A = array( [[1,60], [2,537], [3, 20]] )
  </code></pre>
  
  <p>I have given a small example here, but I would like to know of a way where the implementation is the <strong>fastest</strong>. Presently, I am using the following method:</p>
  
  <pre><code>A_List = map( lambda x: [x,sum(D[x])] , D.keys() )
  </code></pre>
  
  <p>I realize that the output from my method is in the form of a list. I can convert it into an array in another step, but I don't know if that will be a fast method (I presume that the use of arrays will be faster than the use of lists). I will really appreciate an answer where I can know what's the <strong>fastest way</strong> of achieving this aim.</p>