My csv is as follows (MQM Q.csv):
Date-Time,Value,Grade,Approval,Interpolation Code
31/08/2012 12:15:00,,41,1,1
31/08/2012 12:30:00,,41,1,1
31/08/2012 12:45:00,,41,1,1
31/08/2012 13:00:00,,41,1,1
31/08/2012 13:15:00,,41,1,1
31/08/2012 13:30:00,,41,1,1
31/08/2012 13:45:00,,41,1,1
31/08/2012 14:00:00,,41,1,1
31/08/2012 14:15:00,,41,1,1
The first few lines have no "Value" entries but they start later on.
Here is my code:
import pandas as pd
from StringIO import StringIO
Q = pd.read_csv(StringIO("""/cygdrive/c/temp/MQM Q.csv"""), header=0, usecols=["Date-Time", "Value"], parse_dates=True, dayfirst=True, index_col=0)
I get the following error:
Traceback (most recent call last):
File "daily.py", line 4, in <module>
Q = pd.read_csv(StringIO("""/cygdrive/c/temp/MQM Q.csv"""), header=0, usecols=["Date-Time", "Value"], parse_dates=True, dayfirst=True, index_col=0)
File "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 443, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 228, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 533, in __init__
self._make_engine(self.engine)
File "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 670, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 1067, in __init__
col_indices.append(self.names.index(u))
ValueError: 'Value' is not in list