title: How to create a DataFrame while preserving order of the columns?
body: <p>How can I create a DataFrame from multiple <code>numpy</code> arrays, <code>Pandas</code> Series, or <code>Pandas</code> DataFrame's while preserving the order of the columns?</p>
  
  <p>For example, I have these two <code>numpy</code> arrays and I want to combine them as a <code>Pandas</code> DataFrame.</p>
  
  <pre><code>foo = np.array( [ 1, 2, 3 ] )
  bar = np.array( [ 4, 5, 6 ] )
  </code></pre>
  
  <p>If I do this, the <code>bar</code> column would come first because <code>dict</code> doesn't preserve order.</p>
  
  <pre><code>pd.DataFrame( { 'foo': pd.Series(foo), 'bar': pd.Series(bar) } )
  
      bar foo
  0   4   1
  1   5   2
  2   6   3
  </code></pre>
  
  <p>I can do this, but it gets tedious when I need to combine many variables.</p>
  
  <pre><code>pd.DataFrame( { 'foo': pd.Series(foo), 'bar': pd.Series(bar) }, columns = [ 'foo', 'bar' ] )
  </code></pre>
  
  <p>EDIT: Is there a way to specify the variables to be joined and to organize the column order in one operation? That is, I don't mind using multiple lines to complete the entire operation, but I'd rather not having to specify the variables to be joined multiple times (since I will be changing the code a lot and this is pretty error prone).</p>
  
  <p>EDIT2: One more point. If I want to add or remove one of the variables to be joined, I only want to add/remove in one place.</p>