Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python switch columns order csv

import pandas as pd
df = pd.read_csv('/path/to/sample.csv')
df_reorder = df[['A', 'B', 'C', 'D', 'E']] # rearrange column here
#you may need to use zip(*[['A', 'B', 'C', 'D', 'E']])
df_reorder.to_csv('/path/to/sample_reorder.csv', index=False)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #switch #columns #order #csv
ADD COMMENT
Topic
Name
9+1 =