pandas读取csv数据时设置index

比如读取数据时想把第一列设为index,那么只需要简单的

 

pd.read_csv("new_wordvecter.csv",index_col=[0]) 

 

 这里index_col可以设为列名

后续更改index可以使用df.index = df.iloc[:,"column"].tolist()或df.set_index('column')

 

 

 

 

posted @ 2018-05-05 11:05  dylan9  阅读(2628)  评论(0编辑  收藏  举报