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 th
Pandas has a merge_ordered function, so your solution is now as simple as:
z = pd.merge_ordered(x, y, on='state')