Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.
423 Discussions

Pandas relative path can't find pandas\_libs\parsers.pyx

bernardo_t_
Beginner
13,531 Views

Hi,

I'm using Intel Python3 with Pandas 0.24.2, though when I try to use the read_csv function I get the following error:

F:\Dropbox\Bernardo\My_papers\Paper3\data_and_calcs>c:\intelpython3\python.exe print_diagnostics.py
Traceback (most recent call last):
  File "print_diagnostics.py", line 133, in <module>
    plot_hypervolume(ax[0], files[0], labels[0], colors[0], titles[0])
  File "print_diagnostics.py", line 37, in plot_hypervolume
    df = pd.read_csv(f, sep=' ')
  File "c:\intelpython3\lib\site-packages\pandas\io\parsers.py", line 702, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "c:\intelpython3\lib\site-packages\pandas\io\parsers.py", line 429, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "c:\intelpython3\lib\site-packages\pandas\io\parsers.py", line 895, in __init__
    self._make_engine(self.engine)
  File "c:\intelpython3\lib\site-packages\pandas\io\parsers.py", line 1122, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "c:\intelpython3\lib\site-packages\pandas\io\parsers.py", line 1853, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas\_libs\parsers.pyx", line 387, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas\_libs\parsers.pyx", line 705, in pandas._libs.parsers.TextReader._setup_parser_source
FileNotFoundError: [Errno 2] File b'F' does not exist: b'F'

It looks like the issue is that Python is looking for parsers.pyx in a relative rather than absolute path. What should I do?

Thanks,

Bernardo

0 Kudos
1 Reply
bernardo_t_
Beginner
13,531 Views

Found the problem.

For some reason, VS Code was creating the a file names parsers.pyx in <script directory>/pandas/ because I was passing the wrong csv file name as the argument to pd.read_csv(). Once I fixed the name of the csv file the error disappeared.

0 Kudos
Reply