<human>:  How can a pandas merge preserve order?
<bot>: Here is some code to do a `left` merge of dataframes `x` and `y` on the column `state` and sort by `index`

x.reset_index().merge(y, how='left', on='state', sort=False).sort('index')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.