title: How can a pandas merge preserve order?
body: <p>I have two DataFrames in pandas, trying to merge them. But pandas keeps changing the order. I've tried setting indexes, resetting them, no matter what I do, I can't get the returned output to have the rows in the same order. Is there a trick?
    Note we start out with the loans order 'a,b,c' but after the merge, it's "a,c,b".</p>
  
  <pre><code>import pandas
  loans = [  'a',  'b', 'c' ]
  states = [  'OR',  'CA', 'OR' ]
  x = pandas.DataFrame({ 'loan' : loans, 'state' : states })
  y = pandas.DataFrame({ 'state' : [ 'CA', 'OR' ], 'value' : [ 1, 2]})
  z = x.merge(y, how='left', on='state')
  </code></pre>
  
  <p>But now the order is no longer the original 'a,b,c'. Any ideas? I'm using pandas version 11.</p>