python pandas not reading first column from csv file

前端 未结 3 704
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-16 10:06

I have a simple 2 column csv file called st1.csv:

GRID    St1  
1457    614  
1458    657  
1459    679  
1460    732  
1461    754  
1462    811  
1463    7         


        
3条回答
  •  感情败类
    2020-12-16 10:15

    Judging by your data it looks like the delimiter you're using is a .

    Try the following:

    a = pandas.DataFrame.from_csv('st1.csv', sep=' ')
    

    The other issue is that it's assuming your first column is an index, which we can also disable:

    a = pandas.DataFrame.from_csv('st1.csv', index_col=None)
    

提交回复
热议问题