One - One Code All

Blog Content

pandas中的DataFrame按指定顺序输出所有列

Python 统计学-科学计算   2010-11-08 16:30:05

输出所有栏目列名:df.columns

cols=['id','name']
df=df.ix[:,cols]

df=df.ix[:,cols]语句表示,DataFrame的行索引不变,列索引是cols中给定的索引。


上一篇:pandas处理数据的常用函数和方法
下一篇:pandas将列表List转换为数据框Dataframe,pd.DataFrame(list)

The minute you think of giving up, think of the reason why you held on so long.