📜  python 切换列顺序 csv - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:59.387000             🧑  作者: Mango

代码示例1
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)