📜  python 更多的列顺序 - Python 代码示例

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

代码示例1
In [7]: cols = df.columns.tolist()
In [8]: cols
Out[8]: [0L, 1L, 2L, 3L, 4L, 'mean']

In [12]: cols = cols[-1:] + cols[:-1]

In [13]: cols
Out[13]: ['mean', 0L, 1L, 2L, 3L, 4L]
  
In [14]: df = df[cols]