Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python change column order in dataframe

cols = df.columns.tolist()
cols = cols[-1:] + cols[:-1] #bring last element to 1st position
df = df.reindex(cols, axis=1)
Source by www.kite.com #
 
PREVIOUS NEXT
Tagged: #python #change #column #order #dataframe
ADD COMMENT
Topic
Name
3+6 =