File exists but Python says 'not found'.

prerit86 at prerit86 at
Mon Jul 1 12:47:14 CEST 2013

I'm running this code that reads 2 csv files (one of them is train.csv). The code gives an error saying 'file not does not exist'. However, the file does exists in the same location as the .py file. Can someone please help me on this. Thanks!

Code Output-->

Reading dataset...
Traceback (most recent call last):
  File "c:\Project_1\", line 163, in <module>
  File "c:\Project_1\", line 80, in main
    train_data = pd.read_csv(train)
  File "c:\Python27\lib\site-packages\pandas\io\", line 401, in parser
    return _read(filepath_or_buffer, kwds)
  File "c:\Python27\lib\site-packages\pandas\io\", line 209, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "c:\Python27\lib\site-packages\pandas\io\", line 509, in __init
  File "c:\Python27\lib\site-packages\pandas\io\", line 611, in _make_
    self._engine = CParserWrapper(self.f, **self.options)
  File "c:\Python27\lib\site-packages\pandas\io\", line 893, in __init
    self._reader = _parser.TextReader(src, **kwds)
  File "parser.pyx", line 312, in pandas._parser.TextReader.__cinit__ (pandas\sr
  File "parser.pyx", line 512, in pandas._parser.TextReader._setup_parser_source
IOError: File train.csv does not exist

More information about the Python-list mailing list