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 748
However, when I try to read the csv file, the first column is not loaded:
a = pandas.DataFrame.from_csv('st1.csv')
a.columns
outputs:
Index([u'ST1'], dtype=object)
Why is the first column not being read?
解决方案
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=False)