ktl014
7/24/2017 - 4:33 PM

preserve order in dataframe From https://stackoverflow.com/questions/15653688/preserving-column-order-in-python-pandas-dataframe

import pandas
dfdict={}
dfdict["a"]=[1,2,3,4]
dfdict["b"]=[5,6,7,8]
dfdict["c"]=[9,10,11,12]
df=pandas.DataFrame(dfdict)
df.to_csv("dfTest.txt","\t",header=True,cols=["b","a","c"])