Skip to content
Advertisement

Can’t find and read .csv file

I recently brought my code from Jupyter into VSCode. I fixed up some problems with my imports, but now I can’t find a .csv file. The code and .csv file are saved in the same folder. My code is:

import pandas
df = pandas.read_csv('emailss.csv', names=['Email', 'Amiability'])

After running the program, it says,

FileNotFoundError: [Errno 2] No such file or directory: 'emailss.csv'

What’s going on here? How can I fix it? It was working perfectly in Jupyter.

Here is a screenshot:

screenshot of error

Advertisement

Answer

where are you running the code from? Is the CSV file in the same directory as your python file, if yes is the console path the same as the python script and the CSV file?

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement