Sequencing a data set ,using python optimization libraries

I have a dataset i want to sequence them based on the difference between two columns in different rows which should be minimum ,any help?