title: How to add row to pandas DataFrame with missing value efficiently?
body: <p>Suppose I have a many rows with different column names, how to add them to a pandas' DataFrame more efficiently.</p>
  
  <pre><code>d = pd.DataFrame()
  a = {'a':10,'b':1.3}
  b = {'b':32.5,'c':3.14, 'm': 5.1}
  </code></pre>
  
  <p>I want the result like this:</p>
  
  <pre><code>d = 
       a   b  c  m
   1  10 1.3  0  0 
   2  0  32.5 3.14 5.1
  </code></pre>
  
  <p>There are two ways:</p>
  
  <p>1.</p>
  
  <pre><code>d = d.append(pd.DataFrame(a,index=[1]))
  d = d.append(pd.DataFrame(b,index=[2]))
  </code></pre>
  
  <ol start="2">
  <li>get all unique column names first,then</li>
  </ol>
  
  <pre class="lang-py prettyprint-override"><code>column_name = ['a','b','c','m']
  d = pd.DataFrame(columns = column_name)
  d.add(a)
  d.add(b)
  </code></pre>
  
  <p>As the first way need <code>join</code>, so should way 2 be faster than way 1?</p>
  
  <p>Or there are any better solution?</p>